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

Commit

Permalink
trac 22525 better conversion from fricas expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
Frédéric Chapoton committed Sep 11, 2017
1 parent f34394d commit 7775304
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sage/interfaces/fricas.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,14 @@
# http://www.gnu.org/licenses/
###########################################################################
from __future__ import print_function
# from __future__ import absolute_import

from sage.interfaces.tab_completion import ExtraTabCompletion
from sage.interfaces.expect import Expect, ExpectElement, FunctionElement, ExpectFunction
from sage.misc.misc import SAGE_TMP_INTERFACE
from sage.env import DOT_SAGE
from sage.docs.instancedoc import instancedoc
import re
import six


FRICAS_SINGLE_LINE_START = 3 # where the output starts when it fits next to the line number
FRICAS_MULTI_LINE_START = 2 # and when it doesn't
Expand Down Expand Up @@ -1063,14 +1062,15 @@ def _sage_expression(self, unparsed_InputForm):
1/2*sqrt(2)*sqrt(pi)*fresnelS(sqrt(2)*x/sqrt(pi))
"""
from sage.symbolic.ring import SR
from sage.calculus.calculus import symbolic_expression_from_string
from sage.libs.pynac.pynac import symbol_table
s = unparsed_InputForm
replacements = [('pi()', 'pi '),
('::Symbol', ' ')]
for old, new in replacements:
s = s.replace(old, new)
try:
return SR(s)
return symbolic_expression_from_string(s, symbol_table["fricas"])
except TypeError:
raise NotImplementedError("The translation of the FriCAS Expression %s to sage is not yet implemented." %s)

Expand Down

0 comments on commit 7775304

Please sign in to comment.