本文整理匯總了Python中wxgeometrie.mathlib.interprete.Interprete.load_state方法的典型用法代碼示例。如果您正苦於以下問題:Python Interprete.load_state方法的具體用法?Python Interprete.load_state怎麽用?Python Interprete.load_state使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wxgeometrie.mathlib.interprete.Interprete
的用法示例。
在下文中一共展示了Interprete.load_state方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_issue_206_ter
# 需要導入模塊: from wxgeometrie.mathlib.interprete import Interprete [as 別名]
# 或者: from wxgeometrie.mathlib.interprete.Interprete import load_state [as 別名]
def test_issue_206_ter():
i = Interprete(verbose = VERBOSE)
etat_interne = \
u"""_ = 0
@derniers_resultats = [
'atan2(x, y)',
]"""
i.load_state(etat_interne)
i.evaluer('ln(9)-2ln(3)')
assertDernier(i, '0')
示例2: test_issue_206_bis
# 需要導入模塊: from wxgeometrie.mathlib.interprete import Interprete [as 別名]
# 或者: from wxgeometrie.mathlib.interprete.Interprete import load_state [as 別名]
def test_issue_206_bis():
i = Interprete(verbose = VERBOSE)
etat_interne = \
u"""_ = 0
@derniers_resultats = [
'Abs(x)',
]"""
i.load_state(etat_interne)
i.evaluer('abs(-24/5 - 2 i/5)')
assertDernier(i, '2*145**(1/2)/5')
示例3: test_load_state2
# 需要導入模塊: from wxgeometrie.mathlib.interprete import Interprete [as 別名]
# 或者: from wxgeometrie.mathlib.interprete.Interprete import load_state [as 別名]
def test_load_state2():
i = Interprete(verbose=VERBOSE)
etat_interne = \
"""_ = '2.56'
@derniers_resultats = [
"'2.56'",
]"""
i.load_state(etat_interne)
i.evaluer('_')
assertDernier(i, '"2.56"')
示例4: test_issue_206
# 需要導入模塊: from wxgeometrie.mathlib.interprete import Interprete [as 別名]
# 或者: from wxgeometrie.mathlib.interprete.Interprete import load_state [as 別名]
def test_issue_206():
i = Interprete(verbose = VERBOSE)
etat_interne = \
u"""_ = 0
@derniers_resultats = [
're(x)',
]"""
i.load_state(etat_interne)
i.evaluer("-1+\i\sqrt{3}")
assertDernier(i, '-1 + 3**(1/2)*I')
i.evaluer('-x**2 + 2*x - 3>>factor')
assertDernier(i, '-x**2 + 2*x - 3')
示例5: test_load_state
# 需要導入模塊: from wxgeometrie.mathlib.interprete import Interprete [as 別名]
# 或者: from wxgeometrie.mathlib.interprete.Interprete import load_state [as 別名]
def test_load_state():
i = Interprete(verbose=VERBOSE)
etat_interne = \
"""_ = 2/5
@derniers_resultats = [
'x^2',
'2/5',
]"""
i.load_state(etat_interne)
i.evaluer('_')
assertDernier(i, '2/5')
i.evaluer('_1')
assertDernier(i, 'x^2')
示例6: test_issue_263
# 需要導入模塊: from wxgeometrie.mathlib.interprete import Interprete [as 別名]
# 或者: from wxgeometrie.mathlib.interprete.Interprete import load_state [as 別名]
def test_issue_263():
i = Interprete(verbose=VERBOSE)
i.evaluer("A = mat([[1;2];[3;4]])")
i.evaluer("B = mat(2)")
i.evaluer("C = A*B")
assert 'C' in i.vars
r, l = i.evaluer("C")
assertEqual(r, "Matrix([\n[1 ; 2] ; \n[3 ; 4]])")
etat_interne = i.save_state()
i.clear_state()
assert 'C' not in i.vars
i.load_state(etat_interne)
assert 'C' in i.vars
r, l = i.evaluer("C")
assertEqual(r, "Matrix([\n[1 ; 2] ; \n[3 ; 4]])")
i.evaluer("A=[[0,1 ; 0,8]; [0,5; 0,5]]")
r, l = i.evaluer("[[0,3 ; 0,4]]*A")
assertEqual(r, "Matrix([[0,23 ; 0,44]])")
# ou encore [0,23 ; 0,44]
assertEqual(l, r"$\begin{pmatrix}0,23 & 0,44\end{pmatrix}$")