Re: Re: Re: function of a function

• To: mathgroup at smc.vnet.net
• Subject: [mg62694] Re: [mg62667] Re: [mg62650] Re: function of a function
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Wed, 30 Nov 2005 22:09:19 -0500 (EST)
• References: <200511301040.FAA07278@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Actually, first equation is also solvable, but you have to use a
"functional method" (which indeed corresponds to "solving infinitely
many differential euations"). Here is a rather simple approach; more
sophisticated ones are possible.

We want to solve the system:

Clear[x, f, EQ];
EQ = {f'[x] == f[Cos[x]], f[0] == 1};

We are going to try to approximate the entire function f over the
range [0,1]. This is actually a case when it can be done.We need a
starting function that satisfies the initial condition f[0]=1. The
functions Cos[x] itself will do. We now do the following:

Do[f[n] = f[n] /.
First[NDSolve[{D[
f[n][x], x] == f[n - 1][Cos[
x]], f[n][0] == 1}, f[n], {x, 0, 1}]], {n, 1, 100}]

The solutions is

Plot[f[100][x], {x, 0, 1}]

By plotting

Plot[{f[100]'[x], , f[100][Cos[x]]}, {x, 0, 1}, PlotStyle -> {Red,
Green}]

we see that the two curves coincide perfectly.

Obviously you could not expect NDSOlve to do this by itself!

Andrzej Kozlowski

On 30 Nov 2005, at 19:40, Andrzej Kozlowski wrote:

>
> On 30 Nov 2005, at 14:07, Narasimham wrote:
>
>> Jens-Peer Kuska wrote:
>>
>>> it can't work because f [0] ==1 given in your differential equation
>>> f ' [0]==f [1] and NDSolve[] can't find the value for
>>> f[1] until it has integrated the equation.
>>
>> ???
>>
>>> The nested dependence is equivalent to an infinite
>>> system of ordinary differential equations and it seems to be
>>> hard to do this by a finte computer.
>>
>> I cannot understand this. In the following two examples the first one
>> works, not the second.
>>
>> Clear[x,f,EQ];
>> EQ={f'[x] == f[Cos[x]],f[0]== 1};
>> NDSolve[EQ,f,{x,0,4}];
>> f[x_]=f[x]/.First[%];
>> Plot[f[x],{x,0,4}];
>>
>> Clear[x,f,EQ];
>> EQ={f'[x] == Cos[f[x]],f[0]== 1};
>> NDSolve[EQ,f,{x,0,4}];
>> f[x_]=f[x]/.First[%];
>> Plot[f[x],{x,0,4}];
>
>
> Surely, you mean the second one works, the first one does not!? Also,
> I think I agree with Jens. These cases are quite different and the
> problem he mentione does not arise in the second case. Ine the second
> case the derivative at a point x is defined only in terms of the
> value of the function at x. Thus values of the function, it's
> derivative, function etc, can be computed sequentially. In the first
> case, however, in order to compute the derivative at x you need to
> know the value of the function at Cos[x], which in general will not
> be known yet. This is, I think, what Jens meant and it seems to me
> clearly right.
>
>>
>> It appears (to me) the power of programming with functions in
>> Mathematica has not been used to the full.
>>
>>
>
> What do you mean? Can you suggest an approximation scheme for this
> sort of problem?
>
> Andrzej Kozlowski
>
>
>
>> Jens-Peer Kuska wrote:
>>> Hi,
>>>
>>> it can't work because f[0]==1 give in your
>>> differential equation
>>> f'[0]==f[1] and NDSolve[] can't find the value for
>>> f[1] until it
>>> has integrated the equation.
>>> The neted dependence is equvalent to a infinite
>>> system of
>>> ordinary differential equations and it seems to be
>>> hard to do
>>> this by a finte computer.
>>>
>>> Regards
>>>   Jens
>>>
>>> "Narasimham" <mathma18 at hotmail.com> schrieb im
>>> Newsbeitrag news:dmha20\$932\$1 at smc.vnet.net...
>>> | Tried to solve numerically:
>>> |
>>> |
>>> 248f76d024c1ac57/0bba983777a07bc9#0bba983777a07bc9
>>> |
>>> | thus:
>>> |
>>> | EQ= { f'[x] == f[f[x]], f[0]== 1} ;
>>> NDSolve[EQ,f,{x,0,2}];
>>> |
>>> | But gives an error.  NDSolve::ndnum:
>>> Differential equation does not
>>> | evaluate to a number at x = 0.
>>> |
>>> | Also does not work even with other f[0] values.
>>> Any way to do that?
>>> |
>>
>

```

• Prev by Date: Re: Re: function of a function
• Next by Date: Re: Problem with RSolve
• Previous by thread: Re: Re: function of a function
• Next by thread: Re: Problem with RSolve