本文整理汇总了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}$")