From: Frank Breitling on
Hello,

I was not able to solve the following differential equation with
Mathematica 7.01.0 using:

NDSolve[{D[x[r]x'[r],r]==0, x[0]==10, x[1]==1}, x, {r,0,1}]

Since my original problem is inhomogeneous and involves interpolating
functions DSolve is not an option.

Is there a way to solve this problem using Mathematica?
Any help is highly appreciated.

Best regards

Frank

From: DrMajorBob on
Define y as follows and compute its derivative:

Clear[x,y,r]
y[r_]=x[r]^2/2;
y'[r]

x[r] (x^\[Prime])[r]

Hence your equations are equivalent to

{y''[r]==0, y[0] == 50, y[1] == 1/2}

The first equation says that y is linear. Specifically,

y[r_] = InterpolatingPolynomial[{{0, 50}, {1, 1/2}}, r]

50 - (99 r)/2

and hence,

x[r_] = Sqrt[2 y[r]]

Sqrt[2] Sqrt[50 - (99 r)/2]

Solving the same thing in Mathematica, we get:

Clear[y]
DSolve[{y''[r]==0,y[0]==50,y[1]==1/2},y,r]
{{y->Function[{r},1/2 (100-99 r)]}}

Or, for the original problem:

Clear[x, r]
DSolve[{D[x[r] x'[r], r] == 0, x[0] == 10, x[1] == 1}, x, r]

{{x -> Function[{r}, -I Sqrt[-100 + 99 r]]}}

That's the same as the earlier (real-valued) solution, even though it
appears to be Complex.

Simplify[-I Sqrt[-100 + 99 r] - Sqrt[2] Sqrt[50 - (99 r)/2],
r < 100/99]

0

Bobby

On Sat, 06 Feb 2010 02:23:21 -0600, Frank Breitling <fbreitling(a)aip.de>
wrote:

> Hello,
>
> I was not able to solve the following differential equation with
> Mathematica 7.01.0 using:
>
> NDSolve[{D[x[r]x'[r],r]==0, x[0]==10, x[1]==1}, x, {r,0,1}]
>
> Since my original problem is inhomogeneous and involves interpolating
> functions DSolve is not an option.
>
> Is there a way to solve this problem using Mathematica?
> Any help is highly appreciated.
>
> Best regards
>
> Frank
>


--
DrMajorBob(a)yahoo.com

From: Frank Breitling on
Dear Bobby,

Thank you very much for your answer.
Unfortunately my original problem doesn't allow for an analytic
solution, since the equation is more complex and involves interpolating
functions.
Therefore my question is whether it is possible to solve my simplified
example using NDSolve or any other non analytic method of Mathematica.

Frank


On 2010-02-06 22:42, DrMajorBob wrote:
> Define y as follows and compute its derivative:
>
> Clear[x,y,r]
> y[r_]=x[r]^2/2;
> y'[r]
>
> x[r] (x^\[Prime])[r]
>
> Hence your equations are equivalent to
>
> {y''[r]==0, y[0] == 50, y[1] == 1/2}
>
> The first equation says that y is linear. Specifically,
>
> y[r_] = InterpolatingPolynomial[{{0, 50}, {1, 1/2}}, r]
>
> 50 - (99 r)/2
>
> and hence,
>
> x[r_] = Sqrt[2 y[r]]
>
> Sqrt[2] Sqrt[50 - (99 r)/2]
>
> Solving the same thing in Mathematica, we get:
>
> Clear[y]
> DSolve[{y''[r]==0,y[0]==50,y[1]==1/2},y,r]
> {{y->Function[{r},1/2 (100-99 r)]}}
>
> Or, for the original problem:
>
> Clear[x, r]
> DSolve[{D[x[r] x'[r], r] == 0, x[0] == 10, x[1] == 1}, x, r]
>
> {{x -> Function[{r}, -I Sqrt[-100 + 99 r]]}}
>
> That's the same as the earlier (real-valued) solution, even though it
> appears to be Complex.
>
> Simplify[-I Sqrt[-100 + 99 r] - Sqrt[2] Sqrt[50 - (99 r)/2],
> r < 100/99]
>
> 0
>
> Bobby
>
> On Sat, 06 Feb 2010 02:23:21 -0600, Frank Breitling <fbreitling(a)aip.de>
> wrote:
>
>> Hello,
>>
>> I was not able to solve the following differential equation with
>> Mathematica 7.01.0 using:
>>
>> NDSolve[{D[x[r]x'[r],r]==0, x[0]==10, x[1]==1}, x, {r,0,1}]
>>
>> Since my original problem is inhomogeneous and involves interpolating
>> functions DSolve is not an option.
>>
>> Is there a way to solve this problem using Mathematica?
>> Any help is highly appreciated.
>>
>> Best regards
>>
>> Frank
>>
>
>


From: Julian Aguirre on
Hi Frank,

> I was not able to solve the following differential equation with
> Mathematica 7.01.0 using:
>
> NDSolve[{D[x[r]x'[r],r]==0, x[0]==10, x[1]==1}, x, {r,0,1}]
>
> Since my original problem is inhomogeneous and involves interpolating
> functions DSolve is not an option.
>
> Is there a way to solve this problem using Mathematica?
> Any help is highly appreciated.

You should follow the lonk

http://reference.wolfram.com/mathematica/tutorial/NDSolveBVP.html

It turns out that NDSolve has an option ShootingMethod that does what
you want.

Juli=E1n

From: DrMajorBob on
> Therefore my question is whether it is possible to solve my simplified
> example using NDSolve or any other non analytic method of Mathematica.

I solved this with DSolve in my post, but NDSolve also works:

NDSolve[{y''[r] == 0, y[0] == 50, y[1] == 1/2}, y, {r, 0, 1}]

{{y->InterpolatingFunction[{{0.,1.}},<>]}}

If your simplified example is like the real problem, there should be a way
to transform, as I did, and solve.

Bobby

On Mon, 08 Feb 2010 03:46:38 -0600, Frank Breitling <fbreitling(a)aip.de>
wrote:

> Dear Bobby,
>
> Thank you very much for your answer.
> Unfortunately my original problem doesn't allow for an analytic
> solution, since the equation is more complex and involves interpolating
> functions.
> Therefore my question is whether it is possible to solve my simplified
> example using NDSolve or any other non analytic method of Mathematica.
>
> Frank
>
>
> On 2010-02-06 22:42, DrMajorBob wrote:
>> Define y as follows and compute its derivative:
>>
>> Clear[x,y,r]
>> y[r_]=x[r]^2/2;
>> y'[r]
>>
>> x[r] (x^\[Prime])[r]
>>
>> Hence your equations are equivalent to
>>
>> {y''[r]==0, y[0] == 50, y[1] == 1/2}
>>
>> The first equation says that y is linear. Specifically,
>>
>> y[r_] = InterpolatingPolynomial[{{0, 50}, {1, 1/2}}, r]
>>
>> 50 - (99 r)/2
>>
>> and hence,
>>
>> x[r_] = Sqrt[2 y[r]]
>>
>> Sqrt[2] Sqrt[50 - (99 r)/2]
>>
>> Solving the same thing in Mathematica, we get:
>>
>> Clear[y]
>> DSolve[{y''[r]==0,y[0]==50,y[1]==1/2},y,r]
>> {{y->Function[{r},1/2 (100-99 r)]}}
>>
>> Or, for the original problem:
>>
>> Clear[x, r]
>> DSolve[{D[x[r] x'[r], r] == 0, x[0] == 10, x[1] == 1}, x, r]
>>
>> {{x -> Function[{r}, -I Sqrt[-100 + 99 r]]}}
>>
>> That's the same as the earlier (real-valued) solution, even though it
>> appears to be Complex.
>>
>> Simplify[-I Sqrt[-100 + 99 r] - Sqrt[2] Sqrt[50 - (99 r)/2],
>> r < 100/99]
>>
>> 0
>>
>> Bobby
>>
>> On Sat, 06 Feb 2010 02:23:21 -0600, Frank Breitling <fbreitling(a)aip.de>
>> wrote:
>>
>>> Hello,
>>>
>>> I was not able to solve the following differential equation with
>>> Mathematica 7.01.0 using:
>>>
>>> NDSolve[{D[x[r]x'[r],r]==0, x[0]==10, x[1]==1}, x, {r,0,1}]
>>>
>>> Since my original problem is inhomogeneous and involves interpolating
>>> functions DSolve is not an option.
>>>
>>> Is there a way to solve this problem using Mathematica?
>>> Any help is highly appreciated.
>>>
>>> Best regards
>>>
>>> Frank
>>>
>>
>>
>


--
DrMajorBob(a)yahoo.com