Re: Newbie question on FindRoot and NIntergrate
- To: mathgroup at smc.vnet.net
- Subject: [mg80472] Re: Newbie question on FindRoot and NIntergrate
- From: Chris Chiasson <chris.chiasson at gmail.com>
- Date: Thu, 23 Aug 2007 01:08:04 -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 Here is the other part you asked for: sol3=Flatten@NDSolve[hhh'@y==(x@y/.sol)&&hhh@points[[1,1]]==0,hhh, {y,points[[1,1]],points[[-1,1]]}]