Opened 11 years ago

Last modified 8 years ago

#12152 new defect

Maxima fails to properly convert some floats to rationals

Reported by: Dan Drake Owned by: Burcin Erocal
Priority: major Milestone: sage-6.4
Component: calculus Keywords: maxima keepfloat integration
Cc: Karl-Dieter Crisman Merged in:
Authors: Reviewers:
Report Upstream: Reported upstream. No feedback yet. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


From :

sage: a, b, t = var('a b t')
sage: f(a,b,t) = sin(t)^2/(a + b*cos(t))^2
sage: integrate(f(3/2,1,t), (t,0,2*pi))
-2/5*(sqrt(5) - 3)*pi*sqrt(5)

Works properly, but:

sage: integrate(f(1.5,1,t), (t,0,2*pi))

blows up with

RuntimeError: ECL says: Error executing code in Maxima: CRECIP:
attempted inverse of zero (mod 3)

From the discussion there, this seems to be related to Maxima's attempts to convert floats to rationals, and that Sage turns off such conversion with keepfloat:true.

Change History (7)

comment:1 Changed 11 years ago by Karl-Dieter Crisman

See the thread above for some additional discussion, in particular about whether to not consider this a bug, and whether one should just disallow integrals with decimal points.

comment:2 Changed 10 years ago by Karl-Dieter Crisman

Report Upstream: N/AReported upstream. No feedback yet.

Here we go - another such report.

(%i1) keepfloat:true;
(%o1)                                true
(%i2) integrate(exp(-5.3*x),x,0,1);

Maxima encountered a Lisp error:

 Argument V is not a INTEGER: 1.0

Automatically continuing.

Based on this post.

I've reported several similar things upstream at this Maxima bug.

comment:3 Changed 10 years ago by Karl-Dieter Crisman

Interestingly, we never considered the following from an old sage-devel conversation.

No, it means that you have not noticed the value set for ratepsilon,
which governs the tolerance
for conversion of floats to rationals.  It is by default set to
2.0e-8, presumably for "single float"
systems.  It should probably be set to something more like 10e-16 for
double float systems.

Ah, that is very helpful.  In this case the numerical approximations
do indeed agree up to the output of n().  Perhaps we could potentially
go back to keepfloat:false but with whatever the standard precision in
Sage would equate to - Jason, would that help things with matrices?

This would probably keep a lot of problems away, especially since, as Nils says elsewhere, floats and symbolic integrals don't really mix.

Anyway, see also

comment:4 Changed 9 years ago by Jeroen Demeyer

Milestone: sage-5.11sage-5.12

comment:5 Changed 9 years ago by For batch modifications

Milestone: sage-6.1sage-6.2

comment:6 Changed 9 years ago by For batch modifications

Milestone: sage-6.2sage-6.3

comment:7 Changed 8 years ago by For batch modifications

Milestone: sage-6.3sage-6.4
Note: See TracTickets for help on using tickets.