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

Commit

Permalink
quick dirty fix for bug reported by Bill Page, add idea for better ty…
Browse files Browse the repository at this point in the history
…pe handling
  • Loading branch information
mantepse committed Aug 14, 2016
1 parent b2ee8cc commit cbcb94f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/sage/interfaces/fricas.py
Expand Up @@ -464,6 +464,10 @@ def _get_type_str(self):
return m.groups()[0]

def _get_type(self):
"""
TODO: use fricas.eval("dom(%s)") instead. Then we can also use
")set message type off" to get very clean communication!
"""
import ast
def to_list_of_lists(node):
if isinstance(node, ast.Name):
Expand Down Expand Up @@ -570,6 +574,9 @@ def _sage_(self):
sage: _.parent() # optional - fricas
Multivariate Polynomial Ring in y, x over Rational Field
sage: a = fricas("1$Polynomial Integer").sage() # optional - fricas
1
Rational functions:
sage: fricas("x^2 + 1/z").sage() # optional - fricas
Expand Down Expand Up @@ -637,8 +644,11 @@ def _sage_(self):
elif type[0] == "Polynomial":
base_ring = self._get_sage_type(type[1])
vars = self.variables()._get_1d_output()[1:-1]
R = PolynomialRing(base_ring, vars)
return R(self._get_1d_output())
if vars == "":
return base_ring(self._get_1d_output())
else:
R = PolynomialRing(base_ring, vars)
return R(self._get_1d_output())

elif type[0] == "Expression":
if type[1] == "Integer":
Expand Down

0 comments on commit cbcb94f

Please sign in to comment.