Re: a problem about NDSolve and NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg80200] Re: a problem about NDSolve and NIntegrate
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Tue, 14 Aug 2007 07:16:53 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f9emog$lpq$1@smc.vnet.net> <f9p6g1$s1r$1@smc.vnet.net>
lynn wrote:
<snip>
> Thanks for your pointing out my faults.
>
> I miss-typed it when I tried to simplize my equation.
>
> But my original problem still exist,
>
> The following is the original equation,
>
> f[ _?NumberQ] := y[ ] /. NDSolve[{
> 2 y'[ ] y[ ] +
> y''[ ] y[ ] -
> (y'[ ])^2 == y[ ], y[0.00001] == 1, y'[0.00001] == =
> 0}, y,
> { ,
> 0.00001, }, MaxSteps -> 1000][[1]]
>
> then f[5]=InterpolatingFunction[{{0.00001, 5.}}, <>][ ]
>
> and I want to integrate it y[ ] with a ,
>
> \!\(g[w_?NumberQ, _?NumberQ] := 2\
> NIntegrate[\ \/y[ ]=D7 \/\@\( \^2 - w\^2\), { , w, },
> MaxRecursion -> \
> 10]\)
>
> But I can't get correct answer when ask for such as g[1,2]...
Your post does not make any sense: do not use any special character set
when posting to Usenet. (Or use the Ingolf Dahl's "SetFaceAndFont"
palette. See http://library.wolfram.com/infocenter/MathSource/5752/)
I believe that f is defined more or less as follows
In[1]:= f[c_?NumberQ] :=
y[x] /. NDSolve[{2 y'[x] y[x] + y''[x] y[x] - (y'[x])^2 == y[x],
y[0.00001] == 1, y'[0.00001] == 0}, y, {x , 0.00001, c},
MaxSteps -> 1000][[1]]
So you can get an interpolating function with
In[2]:= f[5]
Out[2]= InterpolatingFunction[][x]
and also plot it as in
In[3]:= Plot[Evaluate@f[5], {x, 0.00001, 5}]
[... graphic deleted ...]
As far as I can see in the posted mess, g does not use f, and y[x] is
still *NOT* defined outside of f (this have already been pointed out by
Jens-Peer Kuska a couple of days ago); therefore g has no knowledge of
what could possibly be y[x].
--
Jean-Marc