Fix(Render): Ajust "*" visibility with variables
This commit is contained in:
parent
e6abc208a0
commit
d2f67a0961
@ -20,6 +20,7 @@ Generate and compute like a student!
|
|||||||
2 + 3 * 4
|
2 + 3 * 4
|
||||||
2 + 12
|
2 + 12
|
||||||
14
|
14
|
||||||
|
|
||||||
>>> e = Expression.from_str("2+3/2")
|
>>> e = Expression.from_str("2+3/2")
|
||||||
>>> e_simplified = e.simplify()
|
>>> e_simplified = e.simplify()
|
||||||
>>> print(e_simplified)
|
>>> print(e_simplified)
|
||||||
@ -32,6 +33,7 @@ Generate and compute like a student!
|
|||||||
4 / 2 + 3 / 2
|
4 / 2 + 3 / 2
|
||||||
(4 + 3) / 2
|
(4 + 3) / 2
|
||||||
7 / 2
|
7 / 2
|
||||||
|
|
||||||
>>> e = Expression.from_str("(2/3)^4")
|
>>> e = Expression.from_str("(2/3)^4")
|
||||||
>>> e_simplified = e.simplify()
|
>>> e_simplified = e.simplify()
|
||||||
>>> print(e_simplified)
|
>>> print(e_simplified)
|
||||||
@ -41,6 +43,7 @@ Generate and compute like a student!
|
|||||||
(2 / 3)^4
|
(2 / 3)^4
|
||||||
2^4 / 3^4
|
2^4 / 3^4
|
||||||
16 / 81
|
16 / 81
|
||||||
|
|
||||||
>>> e = Expression.from_str("x^2*x*x^4")
|
>>> e = Expression.from_str("x^2*x*x^4")
|
||||||
>>> e_simplified = e.simplify()
|
>>> e_simplified = e.simplify()
|
||||||
>>> print(e_simplified)
|
>>> print(e_simplified)
|
||||||
|
@ -94,6 +94,8 @@ def mul2tex(left, right):
|
|||||||
>>> a = mo.MOstr('x')
|
>>> a = mo.MOstr('x')
|
||||||
>>> mul2tex(mo.MO(3), a)
|
>>> mul2tex(mo.MO(3), a)
|
||||||
'3x'
|
'3x'
|
||||||
|
>>> mul2tex(a, a)
|
||||||
|
'x \\times x'
|
||||||
"""
|
"""
|
||||||
display_time = True
|
display_time = True
|
||||||
try:
|
try:
|
||||||
@ -121,7 +123,7 @@ def mul2tex(left, right):
|
|||||||
else:
|
else:
|
||||||
right_ = tree2tex(right)
|
right_ = tree2tex(right)
|
||||||
finally:
|
finally:
|
||||||
if right_[0].isalpha():
|
if right_[0].isalpha() and (left_.isnumeric() or left_.isdecimal()):
|
||||||
display_time = False
|
display_time = False
|
||||||
|
|
||||||
if display_time:
|
if display_time:
|
||||||
|
@ -94,6 +94,8 @@ def mul2txt(left, right):
|
|||||||
>>> a = mo.MOstr('x')
|
>>> a = mo.MOstr('x')
|
||||||
>>> mul2txt(mo.MO(3), a)
|
>>> mul2txt(mo.MO(3), a)
|
||||||
'3x'
|
'3x'
|
||||||
|
>>> mul2txt(a, a)
|
||||||
|
'x * x'
|
||||||
"""
|
"""
|
||||||
display_time = True
|
display_time = True
|
||||||
try:
|
try:
|
||||||
@ -121,7 +123,7 @@ def mul2txt(left, right):
|
|||||||
else:
|
else:
|
||||||
right_ = tree2txt(right)
|
right_ = tree2txt(right)
|
||||||
finally:
|
finally:
|
||||||
if right_[0].isalpha():
|
if right_[0].isalpha() and (left_.isnumeric() or left_.isdecimal()):
|
||||||
display_time = False
|
display_time = False
|
||||||
|
|
||||||
if display_time:
|
if display_time:
|
||||||
|
@ -36,7 +36,7 @@ def moscalar_mostr(left, right):
|
|||||||
<MOMonomial 2x>
|
<MOMonomial 2x>
|
||||||
>>> a = MOFraction(1, 5)
|
>>> a = MOFraction(1, 5)
|
||||||
>>> multiply(a, b)
|
>>> multiply(a, b)
|
||||||
<MOMonomial 1 / 5x>
|
<MOMonomial 1 / 5 * x>
|
||||||
"""
|
"""
|
||||||
return MOMonomial(left, right)
|
return MOMonomial(left, right)
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ def mostr_moscalar(left, right):
|
|||||||
<MOMonomial 2x>
|
<MOMonomial 2x>
|
||||||
>>> b = MOFraction(1, 5)
|
>>> b = MOFraction(1, 5)
|
||||||
>>> multiply(a, b)
|
>>> multiply(a, b)
|
||||||
<MOMonomial 1 / 5x>
|
<MOMonomial 1 / 5 * x>
|
||||||
"""
|
"""
|
||||||
return MOMonomial(right, left)
|
return MOMonomial(right, left)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user