[Date Index]
[Thread Index]
[Author Index]
Re: Newbie question on FindRoot and NIntergrate
*To*: mathgroup at smc.vnet.net
*Subject*: [mg80450] Re: Newbie question on FindRoot and NIntergrate
*From*: Chris Chiasson <chris.chiasson at gmail.com>
*Date*: Thu, 23 Aug 2007 00:56:40 -0400 (EDT)
*References*: <fagu3e$937$1@smc.vnet.net>
Hoa Bui wrote:
> Dear all,
>
> Please help me with this problem:
>
> I have a series of points:
> In[9]:=points
> Out[9]={{0.0001,0.359381},{0.0002866,0.403984},{0.000821394,0.454122},{0.00235411,0.510482},{0.00674688,0.573838},{0.0193365,0.645056}}
>
> Define one of my function as the trapezoidal area created by these
> points up to some x:
> linNx = Interpolation[points, InterpolationOrder -> 1];
> ff[x_] := Integrate[linNx[s], {s, 0.0001, x}]
>
> Define the second function as a power law:
> gg[x_] := 0.9 x^(1/0.9)
>
> My third function is the root of the equation:
> hh[x_] := FindRoot[ff[y] == gg[x], {y, 0.0001, 0.019}];
>
> I can evaluate h at specific values of x, e.g. h[0.001] ({y ->
> 0.00107654}), h[0.01] ({y -> 0.0101302}), etc...
>
> Now say I want to use hh[x] in an integral,
> NIntergrate[hh[x],{x, 0.0001, 0.019}]
> obviously it doesn't work, and I have tried using Solve instead of
> FindRoot but it also did not output a numerical value for the integral
> because the inverse function is not in closed form or something..
>
> Is there a way for me to compute the integral of hh[x] ?
>
> Thank you all so much,
> Hoa Bui
points={{0.0001,0.359381},{0.0002866,0.403984},{0.000821394,0.454122},
{0.00235411,0.510482},{0.00674688,0.573838},{0.0193365,0.645056}}
linNx=Interpolation[points,InterpolationOrder->1]
gg[x_]=0.9 x^(1/0.9)
sol=Flatten@NDSolve[ff'@y==linNx[y]&&ff@points[[1,1]]==0&&ff@y==gg@x@y,
{ff,x},{y,points[[1,1]],points[[-1,1]]}]
sol2=Flatten@NDSolve[D[ff@y[x]==gg@x/.DeleteCases[sol,x-
>_],x]&&y[x@points[[1,1]]/.sol]==points[[1,1]],y,
{x,x@points[[1,1]]/.sol,x@points[[-1,1]]/.sol}]
y at 0.001/.sol2
y at 0.01/.sol2
Prev by Date:
**Re: Redefine Arg to return a value from 0 to 2 pi**
Next by Date:
**Re: Re: Redefine Arg to return a value from 0 to 2 pi**
Previous by thread:
**Re: Newbie question on FindRoot and NIntergrate**
Next by thread:
**Re: Newbie question on FindRoot and NIntergrate**
| |