On Jan 19, 9:37 pm, kcrisman <kcris...@gmail.com> wrote: > On Jan 19, 3:16 pm, jeff788 <jeff...@gmail.com> wrote: > > > I am trying to evaluate a definite integral using SAGE and am getting > > some errors. I have evaluated the same integrals using Mathematica > > without a problem. Here is the integral in question: > > > integral(0.298321984000000/((13.1233333333333*X + 1)^2* > > (15.7466666666667*X + 1)),(X,0.05,0.3)) > > > I get the following error: > > > Inverse of zero divisor? > > This is because we use Maxima for our integration, and because we use > keepfloat:true in the "calculus copy" of Maxima. Unfortunately, it > looks like somewhere along the line precision was lost and it thought > we divided by zero. In Sage's Maxima: > > (%i1) keepfloat: true; > (%o1) true > (%i2) integrate(0.298321984000000/((13.1233333333333*X + 1)^2* > (15.7466666666667*X + 1)),X,0.05,0.3); > > Inverse of zero divisor? > -- an error. To debug this try: debugmode(true); > > Interestingly, if one doesn't do keepfloat:true, Maxima automatically > numerically evaluates this to be .003306490701348857 > > > I then tried using the numerical_integral command: > > > numerical_integral(0.298321984000000/((13.1233333333333*X + 1)^2* > > (15.7466666666667*X + 1)),(X,0.05,0.3)) > > > for which I get he following error: > > > TypeError: unable to simplify to float approximation > > You used the wrong syntax (which we need to fix, however; perhaps it > is already in the rc of 4.3.1?). > > sage: numerical_integral(0.298321984000000/((13.1233333333333*X + 1) > ^2* (15.7466666666667*X + 1)),0.05,0.3) > (0.0033064907013495059, 3.6709421073472037e-17) > > I hope this helps! Thank you for your feedback. Perhaps one of the > lurking Maxima devs on the list can tell us what the source of the > first error is, as I unfortunately don't understand all the details of > Maxima float-rational simplification.
The error is actually misleading. I get a better error with sbcl: (%i3) integrate(0.298321984000000/((13.1233333333333*X + 1)^2* (15.7466666666667*X + 1)), X,0.05,0.3); Maxima encountered a Lisp error: Error during processing of --eval option "(cl-user::run)": The value 1.2218777777768821 is not of type FIXNUM. Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. Looks like a serious bug, defint almost always breaks if keepfloat is true any you have floats in the denominator. Should be easy to fix though. Andrej
-- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org