Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 518de3e

Browse files
committedJun 28, 2014
6882: add symable rules for e,i,I; fix maxima_var; add doctests
1 parent 4c1b0eb commit 518de3e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed
 

Diff for: ‎src/sage/calculus/calculus.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1692,15 +1692,16 @@ def _inverse_laplace_latex_(self, *args):
16921692

16931693
#######################################################
16941694

1695-
symtable = {'%pi':'pi', '%e': 'e', '%i':'I', '%gamma':'euler_gamma'}
1695+
symtable = {'%pi':'pi', '%e': 'e', '%i':'I', '%gamma':'euler_gamma',
1696+
'e':'_e', 'i':'_i', 'I':'_I'}
16961697

16971698
import re
16981699

16991700
maxima_tick = re.compile("'[a-z|A-Z|0-9|_]*")
17001701

17011702
maxima_qp = re.compile("\?\%[a-z|A-Z|0-9|_]*") # e.g., ?%jacobi_cd
17021703

1703-
maxima_var = re.compile("\%[a-z|A-Z|0-9|_]*") # e.g., ?%jacobi_cd
1704+
maxima_var = re.compile("[a-z|A-Z|0-9|_\%]*") # e.g., %jacobi_cd
17041705

17051706
sci_not = re.compile("(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]\d+)")
17061707

@@ -1765,13 +1766,21 @@ def symbolic_expression_from_maxima_string(x, equals_sub=False, maxima=maxima):
17651766
sage: solve([2*x==3, x != 5], x)
17661767
[[x == (3/2), (-7/2) != 0]]
17671768
1768-
Check that some variables don't end up as special constants (:trac:`6882`)::
1769+
Check that some hypothetical variables don't end up as special constants (:trac:`6882`)::
17691770
17701771
sage: from sage.calculus.calculus import symbolic_expression_from_maxima_string as sefms
17711772
sage: sefms('%i')^2
17721773
-1
17731774
sage: ln(sefms('%e'))
17741775
1
1776+
sage: sefms('i')^2
1777+
_i^2
1778+
sage: sefms('I')^2
1779+
_I^2
1780+
sage: sefms('ln(e)')
1781+
ln(_e)
1782+
sage: sefms('%inf')
1783+
+Infinity
17751784
"""
17761785
syms = sage.symbolic.pynac.symbol_table.get('maxima', {}).copy()
17771786

0 commit comments

Comments
 (0)
This repository has been archived.