On Dec 13, 6:38 pm, kcrisman <kcris...@gmail.com> wrote: > Yikes! So we wouldn't want > > sage: integrate(1.0*x,x,0,2) > 2 > > to work any more? (Pace the error messages below.) > > Could we not instead try to catch this kind of error and recommend to > the user that they use rationals? Or something...
well, we *could* replace floats with dummy variables, do the integration and evaluate back again. That would at least allow you to do the integrations where the value of the float is irrelevant (as above) and would fail in a reasonable way on things like integrate(x^-1.0,x) [NOW: division by 0 error] integrate(x^-a,x) [error "Is a-1 zero or nonzero] Of course one could get subtle and wonder what integrate( 1/(x-1.0) * 1/(x-1.0), x) should be (i.e., do we treat this as 1/(x-1.0)^2 [this already happens for this particular example], or do we handle 1.0 and 1.0 as independent?) Symbolic integration and floats really don't mix. It's just a matter of deciding how far you want to go before you give up. Maxima's approach of just taking the rational value of the digits of the float (or something close to it) is perhaps not that bad if you absolutely want to return an answer. However, things like sage: integrate(1/(x^2+1.0000001),x) 3/10000*sqrt(11111110)*arctan(3/10000*sqrt(11111110)*x) suggest to me we should have given up. Incidentally, sage: integrate(x^-1.00000000000000000000001,x) RuntimeError: ECL says: Error executing code in Maxima: Division by 0 that's because currently any float gets translated to a "double" in maxima. Maxima has the bfloat type for arbitrary precision floats. Especially with the "binary" interface that gets used for integration, it would be straightforward to translate RealNumber of a precision that does not fit into a double, into a bfloat instead. I don't know how well supported bfloats are in maxima, though (plus, we should probably not be using maxima for anything involving floats anyway) -- 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