[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Symbolica package warning: Using rat() heuristics for double-precisi
From: |
Mike Miller |
Subject: |
Re: Symbolica package warning: Using rat() heuristics for double-precision input (is this what you wanted?) |
Date: |
Fri, 17 Feb 2017 09:17:43 -0800 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Fri, Feb 17, 2017 at 11:42:26 -0500, Przemek Klosowski wrote:
> I don't understand the symbolic package's precision propagation. It seems to
> know e.g. pi to arbitrary precision:
>
> vpa(pi,55)
> ans = (sym) 3.141592653589793238462643383279502884197169399375105821
>
> but calculations seem to be limited to 50 significant digits:
>
> vpa(pi/2,55)
> ans = (sym) 1.570796326794896557998981734272092580795288085937500000
>
> Is there something magic about 50?
No, there is something magic about the double value returned by pi.
The function that converts numeric values has special code to test
whether a given double value is exactly pi (to the extent of double
precision), and replaces that with the string value "pi" for SymPy to
evaluate.
To get pi/2 with more digits, use
vpa (pi, 55) / 2
The doc strings for both sym and vpa mention taking care when
constructing symbolic or variable-precision values from double values
that the user may have intended to represent an exact fraction.
--
mike
- Symbolica package warning: Using rat() heuristics for double-precision input (is this what you wanted?), Stephen Biggs, 2017/02/17
- Re: Symbolica package warning: Using rat() heuristics for double-precision input (is this what you wanted?), Doug Stewart, 2017/02/17
- Re: Symbolica package warning: Using rat() heuristics for double-precision input (is this what you wanted?), Colin Macdonald, 2017/02/17
- Re: Symbolica package warning: Using rat() heuristics for double-precision input (is this what you wanted?), Doug Stewart, 2017/02/17
- Re: Symbolica package warning: Using rat() heuristics for double-precision input (is this what you wanted?), Colin Macdonald, 2017/02/17