all are passed :DDD
This commit is contained in:
parent
316b8bf52b
commit
9ffde06b9c
@ -25,6 +25,7 @@ class Renderable(object):
|
|||||||
|
|
||||||
The default temporary render is Expression in order to perform calculus inside numbers
|
The default temporary render is Expression in order to perform calculus inside numbers
|
||||||
|
|
||||||
|
>>> from .expression import Expression
|
||||||
>>> exp = Expression("2*3/5")
|
>>> exp = Expression("2*3/5")
|
||||||
>>> print(exp)
|
>>> print(exp)
|
||||||
2 \\times \\frac{ 3 }{ 5 }
|
2 \\times \\frac{ 3 }{ 5 }
|
||||||
|
@ -42,10 +42,10 @@ class Expression(Explicable):
|
|||||||
>>> with Expression.tmp_render():
|
>>> with Expression.tmp_render():
|
||||||
... for i in exp.simplify().explain():
|
... for i in exp.simplify().explain():
|
||||||
... i
|
... i
|
||||||
< <class '__main__.Expression'> [2, 3, 5, '/', '*'] >
|
< <class 'pymath.expression.Expression'> [2, 3, 5, '/', '*'] >
|
||||||
< <class '__main__.Expression'> [2, < Fraction 3 / 5>, '*'] >
|
< <class 'pymath.expression.Expression'> [2, < Fraction 3 / 5>, '*'] >
|
||||||
< <class '__main__.Expression'> [2, < Fraction 3 / 5>, '*'] >
|
< <class 'pymath.expression.Expression'> [2, < Fraction 3 / 5>, '*'] >
|
||||||
< <class '__main__.Expression'> [6, 5, '/'] >
|
< <class 'pymath.expression.Expression'> [6, 5, '/'] >
|
||||||
>>> from .render import txt
|
>>> from .render import txt
|
||||||
>>> with Expression.tmp_render(txt):
|
>>> with Expression.tmp_render(txt):
|
||||||
... for i in exp.simplify().explain():
|
... for i in exp.simplify().explain():
|
||||||
|
@ -12,7 +12,7 @@ def str2tokens(exp):
|
|||||||
>>> str2tokens('2*3+4')
|
>>> str2tokens('2*3+4')
|
||||||
[2, 3, '*', 4, '+']
|
[2, 3, '*', 4, '+']
|
||||||
>>> str2tokens('2x+4')
|
>>> str2tokens('2x+4')
|
||||||
[2, < Polynom [0, 1]>, '*', 1, '+']
|
[2, < Polynom [0, 1]>, '*', 4, '+']
|
||||||
"""
|
"""
|
||||||
in_tokens = str2in_tokens(exp)
|
in_tokens = str2in_tokens(exp)
|
||||||
post_tokens = in2post_fix(in_tokens)
|
post_tokens = in2post_fix(in_tokens)
|
||||||
|
Loading…
Reference in New Issue
Block a user