#18888: failing optional mathematica tests, due to bugs in N() and n()
-------------------------------------+-------------------------------------
Reporter: slabbe | Owner:
Type: defect | Status: needs_work
Priority: major | Milestone: sage-7.1
Component: interfaces: | Resolution:
optional | Merged in:
Keywords: mathematica | Reviewers:
Authors: | Work issues: fix `N()` and `n()`
Report Upstream: N/A | Commit:
Branch: public/18888 | 4fd09adee1cffa4fb7922862d20d2587f7837362
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by dimpase):
Replying to [comment:25 vbraun]:
> Whats wrong? With hindsight you need
> {{{
> sage: log(3.14 / 0.005, 2)
> 9.29462074889163
> }}}
> bits of precision to know the next decimal digit, and there is probably
a guard (binary) digit:
> {{{
> sage: pi.n(11)
> 3.14
> sage: pi.n(digits=10)
> 3.141592654
> }}}
well, I am struggling to understand the error here:
E.g. how would you explain the following:
(it sort of works if the precision is specified...)
{{{
sage: mathematica('Pi').n()
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
<ipython-input-1-0b9c467a05fb> in <module>()
----> 1 mathematica('Pi').n()
/home/scratch/dimpase/sage/sage/src/sage/structure/element.pyx in
sage.structure.element.Element.numerical_approx
(build/cythonized/sage/structure/element.c:7330)()
717 """
718 from sage.misc.functional import numerical_approx
--> 719 return numerical_approx(self, prec=prec, digits=digits,
720 algorithm=algorithm)
721 n = numerical_approx
/home/scratch/dimpase/sage/sage/local/lib/python2.7/site-
packages/sage/misc/functional.pyc in numerical_approx(x, prec, digits,
algorithm)
1330
1331 if prec > inprec:
-> 1332 raise TypeError("cannot approximate to a precision of %s
bits, use at most %s bits" % (prec, inprec))
1333
1334 # The issue is not precision, try conversion instead
TypeError: cannot approximate to a precision of 53 bits, use at most
prec[Pi] bits
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/18888#comment:26>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.