       Re: How to interpret this integral?

• To: mathgroup at smc.vnet.net
• Subject: [mg112610] Re: How to interpret this integral?
• From: Leonid Shifrin <lshifr at gmail.com>
• Date: Thu, 23 Sep 2010 04:20:30 -0400 (EDT)

```Hi Julian,

In:= expr = Integrate[(aV*t+v0)*Cos[(aW*t^2)/2+th0+t*w0],{t,0,Ts}]

Out=
(1/(aW^(3/2)))(Sqrt[\[Pi]] (-aW v0+aV w0) Cos[th0-w0^2/(2 aW)]
FresnelC[w0/(Sqrt[aW] Sqrt[\[Pi]])]+Sqrt[\[Pi]] (aW v0-aV w0)
Cos[th0-w0^2/(2 aW)] FresnelC[(aW Ts+w0)/(Sqrt[aW] Sqrt[\[Pi]])]+aV Sqrt[aW]
(-Sin[th0]+Sin[th0+(aW Ts^2)/2+Ts w0])+Sqrt[\[Pi]] (aW v0-aV w0)
(FresnelS[w0/(Sqrt[aW] Sqrt[\[Pi]])]-FresnelS[(aW Ts+w0)/(Sqrt[aW]
Sqrt[\[Pi]])]) Sin[th0-w0^2/(2 aW)])

If you want to treat the point aW = 0 specially, the simplest is to put it
to zero right when the integral
is computed:

In:= exprAt0 = Integrate[(aV*t+v0)*Cos[th0+t*w0],{t,0,Ts}]

Out= (-aV Cos[th0]+aV Cos[th0+Ts w0]-v0 w0 Sin[th0]+(aV Ts+v0) w0
Sin[th0+Ts w0])/w0^2

Alternatively, you can extract it from the full expression, but it st a
little more involved. One way
is to change variable as t = 1/aW, then expand in t around t=Infinity, then
take the limit t->Infinity of the
resulting expression. One subtlety here that you will need to expand to the
second order in t, to
get the correct result:

In:= exprAt0Alt = Limit[Normal@Series
[expr/.aW->1/t,{t,Infinity,2}],t->Infinity]

Out= (-aV Cos[th0]+aV Cos[th0+Ts w0]+w0 (-v0 Sin[th0]+aV Ts Sin[th0+Ts
w0]+v0 Sin[th0+Ts w0]))/w0^2

You can check that the results are the same:

In:= FullSimplify[exprAt0-exprAt0Alt]

Out= 0

Hope this helps.

Regards,
Leonid

On Wed, Sep 22, 2010 at 9:57 AM, Julian <julian.stoev at gmail.com> wrote:

> Hello All,
>
> After long interruption with symbolic computing, I am struggling how
> to make a useful result out of this integral.
>
> Integrate[(aV*t + v0)*Cos[(aW*t^2)/2 + th0 + t*w0, {t, 0, Ts}]
>
> It comes from the differential equations describing the motion of a
> wheeled robot. aV and aW are accelerations and v0, w0, th0 are initial
> conditions. The numerical solution clearly exists for different real
> accelerations, including positive, negative and zero.
>
> However the symbolic solution of Mathematica is:
> (Sqrt[Pi]*(-(aW*v0) + aV*w0)*Cos[th0 - w0^2/(2*aW)]*
>   FresnelC[w0/(Sqrt[aW]*Sqrt[Pi])] + Sqrt[Pi]*(aW*v0 - aV*w0)*
>   Cos[th0 - w0^2/(2*aW)]*FresnelC[(aW*Ts + w0)/(Sqrt[aW]*Sqrt[Pi])]
> +
>  aV*Sqrt[aW]*(-Sin[th0] + Sin[th0 + (aW*Ts^2)/2 + Ts*w0]) +
>  Sqrt[Pi]*(aW*v0 - aV*w0)*(FresnelS[w0/(Sqrt[aW]*Sqrt[Pi])] -
>    FresnelS[(aW*Ts + w0)/(Sqrt[aW]*Sqrt[Pi])])*Sin[th0 - w0^2/
> (2*aW)])/
>  aW^(3/2)
>
> Note that aW can be found inside a Sqrt function and also in the
> denominator. While I can see that FresnelS[Infinity] is well defined,
> so aW==0 should not be a real problem, it is  still very problematic
> how to use this result at this particular point. The case of negative
> aW is also interesting, because it will require a complex FresnelS and
> FresnelC. I somehow managed to remove this problem using
> ComplexExpand, but I am not sure this is the good solution.
>
> I tried to give Assumptions -> Element[{aW, aV, w0, v0, Ts, th0},
> Reals] to the integral, but there is no change in the solution.
>
> While I understand that the solution of Mathematica is correct in the
> strict mathematical sense, I have to use the result to generate a C-
> code, which will be evaluated numerically and the solution I have now
> is not working for this.
>
> Can some experienced user give a good advice how use get a solution of
> the problem?
>