Re: Help -- Weird integration behavior

*To*: mathgroup at smc.vnet.net*Subject*: [mg49353] Re: [mg49345] Help -- Weird integration behavior*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Fri, 16 Jul 2004 06:06:35 -0400 (EDT)*References*: <200407151100.HAA11167@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 15 Jul 2004, at 20:00, Mike wrote: > *This message was transferred with a trial version of CommuniGate(tm) > Pro* > I'm working on a project that I last worked on a couple of years ago, > and I'm trying to pick up where I left off. I had been doing some > integrations using Mathematica 4.2, and all was well. I'm now trying > to use the same workbook, but with Mathematica 5.0, and the > integration that previously seemed to work now gives me a value of > zero. > > Interestingly, when I run the same file on different versions of > Mathematica, I get either zero or an expression: > > --v5.0 (student), Macintosh: zero > --v5.0, Solaris: zero > --v4.2, Macintosh: expression > --v4.0, Windows: expression > > Here's the code: > F[x_, t_] = (ks (UnitStep[x] - UnitStep[x - 0.5]))(UnitStep[t] - > UnitStep[t - 0.5]); > phi[n_, x_] = Sqrt[2] Sin[n Pi x/L] > G[n_, t_] = Integrate[F[x, t] phi[n, x], {x, 0, L}] > > It's the output of this last line that's interesting to me -- either > an expression (I hope) or zero. My questions are: > > -- Did something change in 5.0 that makes it so that this integration > doesn't work correctly? > -- Can anybody out there reproduce my problem (i.e., run these three > cells on different versions and produce different answers?) > > Thanks for the help! > > Yes, things have changed ;-( However: F[x_, t_] = (ks*(UnitStep[x] - UnitStep[x - 0.5]))* (UnitStep[t] - UnitStep[t - 0.5]); phi[n_, x_] = Sqrt[2]*Sin[n*Pi*(x/L)]; Simplify[Integrate[F[x, t]*phi[n, x], {x, 0, L}, GenerateConditions -> False]] (1/(n*Pi))*(Sqrt[2]*ks*L* ((Cos[(1.5707963267948966*n)/L] - Cos[n*Pi])* UnitStep[L - 0.5] + (Cos[n*Pi] - 1)*UnitStep[L])* (UnitStep[t - 0.5] - UnitStep[t])) This is actually a better answer than Mathematica 4.2 gives, since in Mathematica 4.2 you will only get a satisfactory answer if you use 1/2 instead 0.5. Andrzej Kozlowski Chiba, Japan http://www.mimuw.edu.pl/~akoz/

**References**:**Help -- Weird integration behavior***From:*miked378@hotmail.com (Mike)