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
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 <fbrei...@aip.de>
wrote:
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
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
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 <fbrei...@aip.de>
wrote:
> Dear Bobby,
>>> 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.
>>>
My real equation is
D[r^2 k0 T[r]^(5/2) T'[r], r] == 3/2 kB T'[r]-(kB T[r])/n[r] n'[r]
where kB and k0 are constants and n[r] is a monotonically decreasing
(non analytic) function with n[r]->0 for r->infinity.
I think I can't apply your transformation here.
But anyways thanks a lot for your thoughts!
Frank
Bobby
On Mon, 08 Feb 2010 12:15:26 -0600, Frank Breitling <fbrei...@aip.de>
wrote:
Perhaps you can try something like:
n[r_] := Exp[-3 r]; (* You haven't give an approximate function. At
least this is decreasing, and goes to 0 as r goes to inf *)
r0 = 0.001; (* You can try an initial point near the origin, as r =
0 is causing a 1/0 error (because of the r^2 factor of T''[r]) *)
sol = NDSolve[{(D[r^2 k0 T[r]^(5/2) T'[r], r] == 3/2 kB T'[r] - (kB
T[r])/n[r] n'[r]) /. {k0 -> -1.72, kB -> 100},
T[r0] == 10, T'[r0] == -1}, T[r], {r, r0, 1}, AccuracyGoal -> 10]
Plot[T[r] /. sol, {r, r0, 1}, AxesOrigin -> {0, 0}, PlotRange -> All]
You haven't give any value for k0 nor for kB. My election match with
your boundary conditions. If you give an approximate function
(polynomial, for instance) for n[r] and the values for k0 and kB
perhaps we can give you a better solution.
Bye,
JH
The problem you are solving is different from mine for it not having
Dirichlet boundary conditions.
However Udo found the solution as follows:
In[1]:= sol = NDSolve[{D[y[x] D[y[x], x], x] == 0, y[0] == 100, y[1]
== 10},
y, {x, 0, 1},
Method -> {"Shooting",
"StartingInitialConditions" -> {y[0] == 1/1000, y'[0] == -1/100}}]
In[2]:= Plot[sol[[1, 1, 2]][x], {x, 0, 1}]
See his reply at http://www.mathematica.ch/dmug-archive/2010/msg00023.html
.
This is what I was looking for and clearer than at the Wolfram page
mentioned above.
Cheers
Frank