Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1457 > unrolled thread

Integation Anomoly

Started byblamm64 <blamm64@charter.net>
First post2011-04-04 10:30 +0000
Last post2011-04-05 10:43 +0000
Articles 2 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Integation Anomoly blamm64 <blamm64@charter.net> - 2011-04-04 10:30 +0000
    Re: Integation Anomoly blamm64 <blamm64@charter.net> - 2011-04-05 10:43 +0000

#1457 — Integation Anomoly

Fromblamm64 <blamm64@charter.net>
Date2011-04-04 10:30 +0000
SubjectIntegation Anomoly
Message-ID<inc6kd$to$1@smc.vnet.net>
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.

[toc] | [next] | [standalone]


#1483

Fromblamm64 <blamm64@charter.net>
Date2011-04-05 10:43 +0000
Message-ID<inerop$j7p$1@smc.vnet.net>
In reply to#1457
Sorry, I forgot to include the definitions of wCarStepR and wCarStepL
(thanks to Daniel).  With those definitions included in the proper
place, all the code should be as follows (you don't really need the
definition of wCarStepL to see the behavior I'm seeing, but I left it
in there).  The 'final' definition of wCarStep would be a piecewise
using 0 for t < 0, wCarStepR[t] from 0 <= t <= twTr, and wCarStepL[t]
from t > twTr.


row:=Sqrt[dwCar^2+1]*twTr/dwCar;
tow:=twTr+twTr/(dwCar^2)-row/dwCar;
wCarStepR[t_]=row-Sqrt[row^2-t^2];
wCarStepL[t_]=dwCar*(t-tow);
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

-Brian L.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web