Re: Help -- Weird integration behavior
- To: mathgroup at smc.vnet.net
- Subject: [mg49358] Re: Help -- Weird integration behavior
- From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
- Date: Fri, 16 Jul 2004 06:06:39 -0400 (EDT)
- References: <cd5p22$b5c$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
miked378 at hotmail.com (Mike) wrote: > 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? So it would seem. > -- Can anybody out there reproduce my problem (i.e., run these three > cells on different versions and produce different answers?) Well, running it in v5.0.0 (Windows), I get 0 . Let me guess that your L is always greater than 0. If that guess is correct, then notice the following in v5.0.0, adding an assumption (and replacing your 0.5's by 1/2's): In[1]:= F[x_, t_] = (ks (UnitStep[x] - UnitStep[x - 1/2]))(UnitStep[t] - UnitStep[t - 1/2]); phi[n_, x_] = Sqrt[2] Sin[n Pi x/L]; G[n_, t_] = Assuming[L>0,Integrate[F[x, t] phi[n, x], {x, 0,L}]] Out[1]= -((1/(n*Pi))*(Sqrt[2]*ks*L*(1 - Cos[n*Pi] + (Cos[n*Pi] - Cos[(n*Pi)/(2*L)])* UnitStep[-(1/2) + L])*(UnitStep[-(1/2) + t] - UnitStep[t]))) I have not checked to see if that result is correct. HTH, David Cantrell