On Jan 19, 3:16 pm, jeff788 <[email protected]> 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. But at any rate you should not need to use Mathematica for numerical integration; we use the GSL at the level of a C library, I think, so it should be fine for these purposes. - kcrisman - kcrisman
-- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
