Re: non-linear boundary value problem
- To: mathgroup at smc.vnet.net
- Subject: [mg30284] Re: non-linear boundary value problem
- From: bghiggins at ucdavis.edu (Brian Higgins)
- Date: Sat, 4 Aug 2001 20:02:11 -0400 (EDT)
- References: <9kg1h0$ii8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Richard, Here is one method based on a shooting technique. Consider
the following BVP:
y''[x]+Sin[y[x]]=Cos[5x]
y[-1]=0,y[1]=0
Note the eqns are nonlinear due to the Sin[y[x]] term.
Write the above as two first order ODEs by letting
y1[x]=y[x]
y1'[x]=y2[x]
y2'[x]=-Sin[y1[x]]+Cos[x]
with initial conditions
y1[-1]=0,y2[-1]=a
Here the parameter a is the unknown "initial condition" we want to
find such that y1[1]=0.
The following code implements the shooting technique
system[a_] := {y1'[x] == y2[x], y2'[x] == -Sin[y2[x]] + Cos[5x],
y1[-1] == 0,
y2[-1] == a};
myODEsoln[a_] := NDSolve[system[a], {y1[x], y2[x]}, {x, -1, 1}]
yend[a_] := (y1[x] /. myODEsoln[a]) /. x -> 1
bc = FindRoot[First[yend[a]] == 0, {a, -2, 2}];
Plot[Evaluate[y1[x] /. myODEsoln[a /. bc]], {x, -1, 1},
AxesLabel -> {"x", "y1(x)"}];
This method can be used to solve higher order systems with a variety
of BCs. The key is to determine good guesses for the FindRoot
algorithm.
If the equations are very stiff, then it is advisible to plot the
solution as a function of a to get some idea how the solution behaves
before attempting a Findroot calculation.
Have fun
Cheers,
Brian
Richard S Hsu <rhsu at U.Arizona.EDU> wrote in message news:<9kg1h0$ii8$1 at smc.vnet.net>...
> Hi, I am sorry that I asked a wrong question before.
> The question should be
> Where I could find a mathematica program to solve
> a non-linear boundary value problem :
>
> f''[ x ] == g[ f[x] ], f[0] == a, f'[L] == b ,
>
> where g is a known function, a,b and L are constants.
>
> The NDSolve does not work for non-linear problems.
>
> Thanks.