Thanks for the response, kcrisman. The questions you ask are exactly what I've been pondering myself. After much additional messing around, I found the problem (and its solution):
the factor in front should be 2/a, not a/2: sage: var('a, n, x') (a, n, x) sage: assume(a>0) sage: assume(n,'integer') sage: integral(2/a * x * sin(n*pi*x/a)^2,x,0,a).simplify_full() 1/2*a (I apologize for taking up bandwidth on this.) Jim On Oct 19, 2009, at 12:25 AM, kcrisman wrote: > On Oct 19, 1:02 am, Jim Clark <jimfortheea...@earthlink.net> wrote: >> 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. > > Dear Jim, > > Hmm, I get the same answer as Sage with Wolfram Alpha. Are you sure > you typed this in correctly? Don't forget to use u-substitution in > calculating <x> - it looks like maybe something like that might > account for the missing constants. > > > Hope we can resolve this for you! > > - kcrisman --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---