Integation Anomoly
- To: mathgroup at smc.vnet.net
- Subject: [mg117917] Integation Anomoly
- From: blamm64 <blamm64 at charter.net>
- Date: Mon, 4 Apr 2011 06:30:42 -0400 (EDT)
I define a function (of time) which is basically a "hook" at the origin and (smoothly) transitions to a constant slope line at time <twTr>. The slope of the line is <dwCar>. This piecewise smooth curve (defined as constant 0 for t<0 as well) represents an input angular speed to kinematically drive a mechanical system. Its value and slope at t=0 is zero. The kinematic drive removes one variable from the governing differential equations of motion of an assembly, and therefore I need to determine the rotation and acceleration resulting from the speed profile, since other unknowns are kinematically tied to this drive. So I defined the acceleration and rotation with a derivative and an integration of the piecewise speed, which can be done 'analytically' to yield functions of time, especially so the integration does not have to be numeric and done 'inside' NDSolve (I do two integrations, one for each piece of the speed, and recombine those individual results). The resulting integral at time zero should be zero, but when I first ran NDSolve I got a divide by zero error, which not only aborted the solve but crashed Mathematica, currupted the entire notebook, and rendered it unrecoverable (luckily I had backups). The code below is my attempt at isolating the problem. It appears for one, and only one, exact value of <dwCar> (15) does the result of the integration I used come out 'incorrectly'. It's not technically 'incorrect' but there is a t^2 in a denominator that does not appear for any other exact numbers except dwCar=15, which just happened to be what I used for the 'target' constant acceleration in one of the simulations. Using for example 151/10, or any other exact number except 15 does not manifest the t^2 term in a denomintor. Please see the following code and help me understand what might be happening and especially why the particular behavior for only that one exact value of dwCar=15. The < thCA1sd[t_] > definition is the one showing the anomolous behavior. This behavior occurs in both Mathematica 7.0.1 and 8.0.1 (Win 7 Pro 64 bit). row:=Sqrt[dwCar^2+1]*twTr/dwCar; tow:=twTr+twTr/(dwCar^2)-row/dwCar; Assuming[twTr>0 && dwCar>0,(wCarStepR[twTr]==wCarStepL[twTr])// FullSimplify] thCA1s[t_]=Assuming[0<=t<=twTr && twTr>0 && dwCar>0,Integrate[wCarStepR[tau],{tau,0,t}]] thCA2s[t_]=Assuming[0<t<=twTr && twTr>0 && dwCar>0,Integrate[wCarStepR[tau],{tau,0,t}]] thCA1s[t]==thCA2s[t] thCA1sd[t_]:=Assuming[0<=t<=twTr && twTr>0 && dwCar>0,Integrate[wCarStepR[tau],{tau,0,t}]] thCA2sd[t_]:=Assuming[0<t<=twTr && twTr>0 && dwCar>0,Integrate[wCarStepR[tau],{tau,0,t}]] thCA1sd[t]==thCA2sd[t] Number Trials dwCar=16;twTr=1/500;N[{row,tow},10] thCA1s[t] thCA1sd[t] (thCA1s[t]==thCA1sd[t])//FullSimplify (thCA2s[t]==thCA2sd[t])//FullSimplify {thCA1sd[t]==thCA2sd[t],thCA1s[t]==thCA2s[t]} Clear[dwCar,twTr] dwCar=15;twTr=1/500;N[{row,tow},10] thCA1s[t] thCA1sd[t] (thCA1s[t]==thCA1sd[t])//FullSimplify (thCA2s[t]==thCA2sd[t])//FullSimplify {thCA1sd[t]==thCA2sd[t],thCA1s[t]==thCA2s[t]} (thCA1sd[t]==thCA2sd[t])//FullSimplify a=thCA1sd[t]//FullSimplify;b=thCA2sd[t]//FullSimplify;a==b Note especially the last two lines, they always agree exept where dwCar=15. It is also peculiar the 'anomolay' occurs for the SetDelayed definition of thCA1 (thCA1sd) but not ever the the Set definition of thCA1 (thCA1s). Thanks, -Brian L.