On Feb 8, 7:53 pm, rjf <fate...@gmail.com> wrote:
> Keepfloat is explicitly set to false in the solve program, and the
> comments in the source code say so.

And there are other places this is mentioned as well.  However, there
is at least one (already existing, and not from a Sage user afaik) bug
report of another place this is not documented.

> Perhaps there should be a comment to the effect that indefinite
> symbolic integration
> is an algorithm that in its full generality requires the application
> of exact rational arithmetic.
> In particular  the integration program (or more particularly if  the
> solve
> program is called by integration) the system temporarily sets
> keepfloat to false.

Yes, this sounds like a good idea to make more explicit.

As far as I understand it, using keepfloat:true is an attempt to keep
things *more* exact, not less.  From Ticket #2400:
+++++++
sage: f = e^(-x^2)
sage: f.integrate(x, 0, 0.1)
2066*sqrt(pi)/36741
sage: f.integrate(x, 0, 1/10)
sqrt(pi)*erf(1/10)/2

Hmmmm. Does this mean erf(1/10) is a rational number?
++++++++
Current behavior is
sage: f = e^(-x^2)
sage: f.integrate(x,0,1/10)
1/2*sqrt(pi)*erf(1/10)
sage: f.integrate(x,0,0.1)
0.0562314580091*sqrt(pi)
sage: n(2066/36741)
0.0562314580441469

sage: numerical_integral(f,0,0.1) #GSL numerical integration
(0.099667664290336341, 1.1065333570574191e-15)
sage: f.nintegrate(x,0,0.1) #Maxima numerical integration
(0.099667664290336355, 1.1065333570574201e-15, 21, 0)
sage: f.integrate(x,0,0.1).n() #Maxima symbolic with keepfloat:true,
then converted to RR
0.0996676642903363
sage: n(2066*sqrt(pi)/36741) #Maxima's own answer, converted to RR
0.0996676643523801

So I guess that explains the genesis of this, and why we should
probably keep it in place for now.  Maybe our integration should also
have a note with exactly the kind of example from the original poster
that points out there could be some error at high precision because of
this?

Also note that we still use the default for some matrix manipulations
which otherwise would crash and burn, so it's not that keepfloat:true
is considered a panacea, just a solution to a bug.

- kcrisman

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to