MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Boundary Value Problems

  • To: mathgroup at
  • Subject: [mg15018] Re: [mg14997] Boundary Value Problems
  • From: Jurgen Tischer <jtischer at>
  • Date: Sat, 5 Dec 1998 01:30:21 -0500
  • Organization: Universidad del Valle
  • References: <>
  • Sender: owner-wri-mathgroup at

I have no package but teach my students how to use Mathematica to solve
boundary problems with shooting. And I think Mathematica is able to
treat quite nasty ODE's. I add two examples to illustrate the method. 

1. Example, easy, to show the method

Mathematica's NDSolve is not able to solve the following (generalized)
boundary problem automatically.

NDSolve[{y'''[t] - t y'[t] + 2 y[t] == -10 + t, y[-1] == 3, 
   y'[2] == 4, y[4] == 3}, y, {t, -1, 4}]

We define

f1[a_, b_] := NDSolve[{y'''[t] - t y'[t] + 2 y[t] == -10 + t, y[-1] ==
    y'[-1] == a, y''[-1] == b}, y, {t, -1, 4}]


and solve with FindRoot.



2. Example, from the book of Stoer and Bulirsch, which they use to
illustrate that simple shooting is NOT sufficient to solve nasty
problems and use it as motivation to introduce multiple shooting (and I
demonstrate that Mathematica does it with simple shooting and ease).

The problem: y''[t]==5 Sinh[5 y[t]], y[0]==0, y[1]==1

There is an analytic solution, but Mathematica doesn't find it:

In[1]:= DSolve[y''[t] == 5*Sinh[5*y[t]], y, t]

  "Inverse functions are being used by Solve, so some solutions may not
be found."

Out[1]= {{y -> (-Infinity & )}, {y -> (Infinity & )}}

We proceed as before,

f3[a_]:=NDSolve[{y''[t]==5 Sinh[5 y[t]],y[0]==0,y'[0]==a},y,{t,0,1}]

but it turns out that the solution sometimes doesn't reach the right

In[2]:= f3[1]
    "At t == 0.43129882432337574, step size is effectively zero;
singularity suspected."

Out[2]= {{y->InterpolatingFunction[{{0.,0.431299}},"<>"]}}

We turn off the message


and cheat a bit in the definition of the second function


If f3[a] doesn't reach the right extreme, we use instead the last value
calculated. Now we proceed again as before.



I think this shows how to solve a large class of boundary value


Wretch wrote:
> Have any useful packages been written to solve boundary value
> (eigenvalue) problems?  For instance, something that discretizes nasty
> ODE and solves the resulting matrix equation for the eigenvalues?  I
> checked the FAQ and the MathSource link at the Mathematica webpage, but
> I found nothing particularly useful.
> Thanks,
> AC

  • Prev by Date: Re: Contour Integration
  • Next by Date: Re: How to create a mask with a hole in it?
  • Previous by thread: Boundary Value Problems
  • Next by thread: Contour Integration