Hi sage supporters, I am attempting to verify some properties of the quantum mechanics "particle in a box" problem. integral() is returning the wrong results for <x> and <x^2>. I can't figure out what I might be doing wrong.
To find <x>: ---------------------------------------------------------------------- | Sage Version 4.1.2, Release Date: 2009-10-14 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: var('a, n, x') (a, n, x) sage: assume(a > 0) sage: assume(n, 'integer') sage: integral(a/2 * x * sin(n*pi*x/a)^2,x,0,a).simplify_full() 1/8*a^3 The result should be a/2, which can almost be verified by inspection, but I have worked out the integral by hand also, and I am confident that a/2 is the correct result. To find <x^2>: sage: integral(a/2 * x^2 * sin(n*pi*x/a)^2,x,0,a).simplify_full() 1/24*(2*pi^2*a^4*n^2 - 3*a^4)/(pi^2*n^2) I believe that the correct result is 1/3*a^2. However, sage does perform the indefinite integrals correctly: sage: integral(x*sin(x)^2,x) 1/4*x^2 - 1/4*x*sin(2*x) - 1/8*cos(2*x) (which I used to hand-calculate <x>, getting the result a/2.) and sage: integral(x^2*sin(x)^2,x) 1/6*x^3 - 1/8*(2*x^2 - 1)*sin(2*x) - 1/4*x*cos(2*x) I am running sage 4.1.2 on OS X 10.4 (compiled myself from source). Thanks in advance for any insights! Jim Clark --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---