In the present example all data are exact and the results is OK In the previous example you have mixed symbolic and numerical data (0.1) and that was risky Andrzej
On 5 Mar, 23:59, David Harvey <[EMAIL PROTECTED]> wrote: > Begin forwarded message: > > > > > From: Andrzej Chrzęszczyk <[EMAIL PROTECTED]> > > Date: March 5, 2008 6:23:53 PM EST > > To: [EMAIL PROTECTED] > > Subject: sage-devel "exact" numerical integration > > > Dear David > > Try > > > sage: maxima_console() > > (%i1) integrate(%e^(-x^2),x,0,0.1); > > ................................... > > `rat' replaced .05623145800914245 by 2066/36741 = .05623145804414686 > > 2066 sqrt(%pi) > > (%o1) -------------- > > 36741 > > > then you will see that (behind the scene) > > maxima replaces more accurate result .05623145804414686 sqrt(%pi) > > by the less accurate one: 2066 sqrt(%pi)/36741 (default maxima > > behaviour) > > > Your exact calculations are OK but why do you mix the exact-inexact. > > Pure numerical version using GSL: > > > sage: numerical_integral(lambda x:e^(-x^2),0,-.1) > > (-0.099667664290336327, 1.1065333570574191e-15) > > > is in a good accordance with your exact calculations > > > Andrzej Chrzeszczyk > > > (I'm not in sage-devel so I'm using your e-mail adress, > > I hope You will excuse me) > > Okay, I can see this makes sense from within Maxima, since you get to > see the "replacement" message. > > But in Sage, it's really terrible! When I do > > sage: f = e^(-x^2) > sage: f.integral(x, 0, 0.1) > 2066*sqrt(pi)/36741 > > I have absolutely no idea what is going on in the background. It > could be maxima, or sympy, or some other library that someone plugged > in, or who knows what. > > How am I supposed to tell that 2066*sqrt(pi)/36741 is not an exact > answer? Since it contains sqrt(pi), it's very suggestive that it's > supposed to be exact. > > Another example: if I do > > sage: f = x*e^(2*x) > sage: f.integral(x, 0, 1) > e^2/4 + 1/4 > > Is that an exact answer? Or it just "close enough" to e^2/4? What use > is the answer if I can't tell? > > david --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---