-
-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
17 changed files
with
370 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.