On Tuesday, March 10, 2015 at 9:04:14 AM UTC-7, Dima Pasechnik wrote:
>
> On 2015-03-10, M M <mirette...@gmail.com <javascript:>> wrote: 
> > I get different results from Sage when I try to get a numerical 
> > approximation for an expression and if I use evaluate a preparse of the 
> > string. I get different results on different versions of sage as well. 
> Here 
> > are samples: 
>
> Integration is done by Maxima, and it is a bloody mess; e.g. 
>

It is, but I suspect that's not the cause here. I think it's just numerical 
instability.

sage: sage: integral(x/(x^3-x+1), x, 1, 2).n(100)
0.56579991645642210974671290281
sage: sage: integral(x/(x^3-x+1), x, 1, 2).simplify_full().n(100)
0.56579991645643344322713389324

i.e., approximating the exact result just needs some more digits to be 
accurate. The default "n" only specifies the precision *used* using 
evaluation, so the error in the numerical approximation isn't a priori 
controlled and depends on the particular evaluation scheme chosen for the 
expression (expect that to be just "left to right evaluate" as you would do 
on a calculator). Specifying more digits to work with should give a better 
result for well-behaved expressions.

In principle, using the RealIntervalField you should get guaranteed digits:

sage: I=integral(x/(x^3-x+1), x, 1, 2)
sage: RealIntervalField(53)(I)
[-infinity .. +infinity]
sage: RealIntervalField(60)(I)
1.?
sage: RealIntervalField(70)(I)
0.566?
sage: RealIntervalField(90)(I)
0.565799917?

Needless to say, probably numerical integration is the better way of 
getting a numerical approximation.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to