Re: Re: Re: NSolve Vs. Elliptic Integral

• To: mathgroup at smc.vnet.net
• Subject: [mg62565] Re: [mg62532] Re: [mg62500] Re: [mg62471] NSolve Vs. Elliptic Integral
• From: Pratik Desai <pdesai1 at umbc.edu>
• Date: Mon, 28 Nov 2005 00:57:52 -0500 (EST)
• References: <20051127155324.GATE8508.eastrmmtao02.cox.net@[172.18.52.8]>
• Sender: owner-wri-mathgroup at wolfram.com

```Bob Hanlon wrote:

>NIntegrate[f[x, m], {x, ArcSin[0.003/Sin[m]], Pi/2}]  taken by itself contains a
>non-numeric (i.e., m in the integrand and the lower limit) and cannot be
>numerically evaluated.
>
>FindRoot provides various numeric values of m to the embedded NIntegrate.
>
>Since the functions are periodic it is easy to obtain multiple solutions with
>FindRoot. Evaluate the following:
>
>Needs["Graphics`"];
>
>Clear[f,g];
>f[x_,m_]:=Sqrt[(1+0.176*Sin[m]^2*Sin[x]^2)*
>        (1+1.018*Sin[m]^2*Sin[x]^2)/(1-Sin[m]^2*Sin[x]^2)];
>g[m_]:=0.159*Sqrt[1/(-9*10^(-6)+Sin[m]^2)];
>
>Off[Plot::plnr];
>k=3;
>Plot[{NIntegrate[f[x,m],{x,ArcSin[0.003/Sin[m]],Pi/2}],g[m]},
>    {m,-1/2,k*Pi+1/2},PlotStyle->{Blue,Red},
>    Frame->True,Axes->False,ImageSize->432,
>    FrameTicks->{Automatic,Automatic,PiScale,Automatic},
>    PlotPoints->Ceiling[33k+9],
>    PlotRange->{-0.1,10.1}];
>
>Off[NIntegrate::nlim];
>soln=m/.FindRoot[
>          NIntegrate[f[x, m], {x, ArcSin[0.003/Sin[m]], Pi/2}] == g[m],
>          {m, #}]& /@ Flatten[Table[{-0.1, 0.1} + n*Pi, {n, 0, k}]]
>
>Table[Partition[soln, 2][[n+1]] - n*Pi, {n, 0, k}]
>
>
>Bob Hanlon
>
>
>
>>From: Pratik Desai <pdesai1 at umbc.edu>
To: mathgroup at smc.vnet.net
>>Date: 2005/11/27 Sun AM 02:40:09 EST
>>Subject: [mg62565] [mg62532] Re: [mg62500] Re: [mg62471] NSolve Vs. Elliptic
>>
>>
>Integral
>
>
>>Bob Hanlon wrote:
>>
>>
>>
>>>NSolve is intended primarily for polynomials (see Help browser).  Use
>>>FindRoot.
>>>
>>>Clear[f,g];
>>>
>>>f[x_,m_]:=Sqrt[(1+0.176*Sin[m]^2*Sin[x]^2)*
>>>       (1+1.018*Sin[m]^2*Sin[x]^2)/(1-Sin[m]^2*Sin[x]^2)];
>>>
>>>g[m_]:=0.159*Sqrt[1/(-9*10^(-6)+Sin[m]^2)];
>>>
>>>FindRoot[
>>> NIntegrate[f[x,m],{x,ArcSin[0.003/Sin[m]],Pi/2}]==g[m],
>>> {m,1}]
>>>
>>>{m -> 0.102762168294469}
>>>
>>>Plot[{NIntegrate[f[x,m],{x,ArcSin[0.003/Sin[m]],Pi/2}],g[m]},
>>>   {m,0.05,.15},PlotStyle->{Blue,Red},Frame->True,Axes->False];
>>>
>>>
>>>Bob Hanlon
>>>
>>>
>>>
>>>
>>>
>>>>From: "nilaakash at gmail.com" <nilaakash at gmail.com>
To: mathgroup at smc.vnet.net
>>>>
>>>>Date: 2005/11/25 Fri AM 02:25:24 EST
>>>>Subject: [mg62565] [mg62532] [mg62500] [mg62471] NSolve Vs. Elliptic Integral
>>>>
>>>>Dear Friends,
>>>>                      I am facing a problem to NSolve an  Elliptic
>>>>Integral like that.
>>>>
>>>>f[x_] := Sqrt[(1 +
>>>>         0.176*Sin[m]^2*Sin[x]^2)*(1 + 1.018*Sin[m]^2*Sin[x]^2)/(1 -
>>>>           Sin[m]^2*Sin[x]^2)]
>>>>
>>>>g[m] = 0.159*Sqrt[1/(-9*10^(-6) + Sin[m]^2)];
>>>>
>>>>NSolve[NIntegrate[f[x], {x, ArcSin[0.003/Sin[m]], Pi/2}] == g[m], m]
>>>>
>>>>
>>>>Here I want to get an "m" value such that integration value = g[m].
>>>>
>>>>This NSolve shows problem, please could any body tell me how to get
>>>>exact m value.
>>>>
>>>>Thanks.
>>>>
>>>>nilaakash
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>Hi Bob,
>>
>>What version of Mathematica are you using?
>>Because it gives me the result you reported but when I tried to just do
>>the NIntegrate it does not evaluate. Maybe I am missing something??
>>Is this a functionality of find root  (if that is true, that is pretty
>>interesting) or something else
>>
>>
>>Pratik
>>
>>--
>>Pratik Desai
>>UMBC
>>Department of Mechanical Engineering
>>Phone: 410 455 8134
>>
>>
>>
>>
>>
>
>
>
Bob,

Thanks, I was not aware that one can embed the a definate integral with
variable limits in to FindRoot. I have really learned something. Thanks
again for the nice exposition

Regards

Pratik

--
Pratik Desai