Re: non-linear differential equations.
- To: mathgroup at smc.vnet.net
- Subject: [mg16155] Re: non-linear differential equations.
- From: "Kevin J. McCann" <kevinmccann at Home.com>
- Date: Tue, 2 Mar 1999 01:13:08 -0500
- Organization: @Home Network
- References: <7b352l$21k@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Your problem stems from the fact that mathematica is solving for an nth
root, e.g.
Your problem with substitutions:
eqn1 = p - 2^n*(1 + beta[z])*(1 + beta[z] + beta[z]^2)^((n - 1)/2) ==
1/(Ca*r[z])
eqn2 = eqn1 /. p -> 2^n*(n + 2)
eqn3[n_] = eqn2 /. beta[z] -> (z*Derivative[1][r][z])/r[z] /. Ca -> 1
Now let's do n=3 and solve for r'[z]:
Solve[eqn3[3],r'[z]]
You will see that it is a bit messy, but the first root is all real. Then
NDSolve runs very fast:
de=r'[z]==(r'[z]/.Solve[eqn3[3],r'[z]][[1]])
sol = NDSolve[{de, r[3200] == 10^(-7)}, r, {z, -3200, 3200}, MaxSteps ->
100000]
rr=r/.sol[[1]]
rr[3]
0.0312499
Hope this helps. Not sure what you will do for higher order stuff.
Kevin
engp7696 at leonis.nus.edu.sg wrote in message <7b352l$21k at smc.vnet.net>...
>While using Mathematica I have a problem with the solution of the
>following non-linear differential equation:
>
>p - 2^n (1 + beta[z])(1 + beta[z] + beta[z]^2 )^(n-1)/2 == 1/(Ca r[z] )
>
>where
>
>n = is a constant ranging from -infinity to + infinity;
>p = constant = 2^n (n+2)
>beta[z] = z r'[z]/r[z]
>Ca = constant
>
>The boundary condition is
>r[z = 3200] = 10^(-10)
>
>I need to obtain a plot of r vs z.
>
>The problem is
> 1)NDSolve seems to be working only when (n-1)/2 is a whole
> number . i.e for n = 3, 5, 7 etc.
> 2)NDSolve does not work for n < 3 or when (n-1)/2 is not a whole
> number
> 3)Even when NDSolve works for n = 3, 5, 7 etc I also obtain
> imaginary solutions.
>
> This equation has been solved by finite difference methods with no
>problems using a BASIC code.
>
>I would like to know if there is any fool-proof method to solve the
>problem in Mathematica for all n without obtaining imaginary solutions.
>
>
>@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@
> VIVEK PAI
>UNIVERSITY RESIDENCE
>Room : E5-03-29 #04-119, Block 224
>Chemical Engineering Street 21, Bukit Batok
>National University of Singapore Singapore 650224
>Singapore 119260 Phone : 8971197
>Phone : 8742254
> email : engp7696 at .nus.edu.sg
>@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@
>
>