You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trac #17130: Fix coercion bugs in symbolic functions
This uses coercion correctly:
{{{
sage: bessel_Y._eval_(RealField(300)(1), 1.0)
-0.781212821300289
}}}
However, it seems that `__call__()` coerces this result back to the
first parent, giving false precision:
{{{
sage: bessel_Y(RealField(300)(1), 1.0)
-0.781212821300288684511770043172873556613922119140625000000000000000000
000000000000000000000
}}}
Same issue with functions which are evaluated using Maxima, which does
not support arbitrary precision:
{{{
sage: R=RealField(300); elliptic_eu(R(1/2), R(1/8))
0.4950737320232014848642165816272608935832977294921875000000000000000000
00000000000000000000
}}}
The `gamma_inc()` function also mishandles parents:
{{{
sage: gamma_inc(float(0), float(1))
AttributeError: type object 'float' has no attribute 'precision'
}}}
----
Apart from this, this branch also removes lots of boilerplate from
`_eval_` like
{{{
if not isinstance(x, Expression) and not isinstance(y, Expression) and \
(is_inexact(x) or is_inexact(y)):
x, y = coercion_model.canonical_coercion(x, y)
return self._evalf_(x, y, s_parent(x))
}}}
by wrapping `_eval_` inside the new method `_evalf_or_eval_` which
automatically does this boilerplate.
----
Possible follow-ups: #10133, #14766, #16587, #17122, #15200
URL: http://trac.sagemath.org/17130
Reported by: jdemeyer
Ticket author(s): Jeroen Demeyer
Reviewer(s): Ralf Stephan
0 commit comments