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

Commit

Permalink
17953: any symbolic function arg prevents forced result conversion to…
Browse files Browse the repository at this point in the history
… numeric
  • Loading branch information
rwst committed Mar 15, 2015
1 parent 52db42b commit f0fe6f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/sage/functions/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,10 @@ def _maxima_init_evaled_(self, *args):
correctly (see :trac:`7557`)::
sage: t = f(1.2+2*I*elliptic_kc(1-.5),.5)
sage: t._maxima_init_(maxima) # abs tol 1e-13
'0.88771548861928029 - 1.7301614091485560e-15*%i'
sage: maxima(t) # abs tol 1e-13
0.88771548861928029 - 1.7301614091485560e-15*%i
sage: t.n() # abs tol 1e-13
0.887715488619280 - 1.79195288804672e-15*I
0.887715488619280 - 1.73016140914856e-15*I
"""
args_maxima = []
for a in args:
Expand Down
6 changes: 4 additions & 2 deletions src/sage/symbolic/function.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,14 @@ cdef class Function(SageObject):
array([ 0. , 0.84147098, 0.90929743, 0.14112001, -0.7568025 ])
Symbolic functions evaluate non-exact input numerically, and return
symbolic expressions on exact input::
symbolic expressions on exact input, or if any input is symbolic::
sage: arctan(1)
1/4*pi
sage: arctan(float(1))
0.7853981633974483
sage: type(lambert_w(SR(0)))
<type 'sage.symbolic.expression.Expression'>
Precision of the result depends on the precision of the input::
Expand Down Expand Up @@ -444,7 +446,7 @@ cdef class Function(SageObject):

# if the given input is a symbolic expression, we don't convert it back
# to a numeric type at the end
if len(args) == 1 and parent_c(args[0]) is SR:
if any(parent_c(arg) is SR for arg in args):
symbolic_input = True
else:
symbolic_input = False
Expand Down

0 comments on commit f0fe6f4

Please sign in to comment.