|
- In the following, y(x), F(x,y) and R(ya,yb)
denote real vector functions with the real variable x and the vector variables y, ya, yb
of dimension n. The prime denotes
differentiation with respect to the ''free'' real variable x.
This ''free'' real variable x has usually here the physical meanig
of ''space'' (and only seldom ''time''). We search for a solution y as function of x,
given some relation between y, y' and x and some conditions on
y at two points x=a, x=b, the so called boundary conditions.
Specifically the problem dealt with here is:
Find an (at least) one times differentiable function y
defined on the interval
[a,b] such that there holds
y'(x) = F(x,y(x)) for a < x < b
and
R(y(a),y(b)) = 0 .
- The essential difference opposed to initial value problems is the fact that the
length of the interval of existence of the solution is part of the problem setting and
that conditions on the solution are given at two different points. This type of problem
is called a boundary value problem, BVP for short.
For the case of F and R linear in y, y',
there exists a complete existence and uniqueness theory, but for the general
nonlinear case no such general results exist.
- We present here the currently mostly used technique for its solution,
the method of local collocation.
This method consists in three steps:
- One subdivides [a,b] in intervals [xi,xi+1], i=1,..,N-1
with x1 = a , xN = b.
- One replaces the function y on each subinterval by some ''simple'' function
fixed by a number of parameters, e.g. a polynomial or a spline. This function will be
uniquely defined by the requirement taking at xi the value of the corresponding piece
at the left (resp. ya for i=1) and satisfying
the differential function at given nodes inside [xi,xi+1].
- In addition one requires that the function composed from these pieces satisfies the boundary conditions.
For example in the simplest case used here we choose a vector of linear polynomials fixed by their
value at xi and satisfying the differential equation in the middle of the
interval:
pi(x)=pi,0 + (x - xi)*pi,1 , i.e. pi'(x) = pi,1
- pi(xi) = yi , fixing pi,0
- p'i = F ( (xi+xi+1)/2 , p((xi+xi+1)/2) ),
fixing pi,1
and set
yi+1 = pi(xi+1) , which makes the composed function continuous.
- This method is called the implicit midpoint rule.
- This results in a finite system of (non)linear equations for the unknown values
of yi at the grid points and can be rewritten as
- yi+1 - yi -(xi+1 - xi)F((xi+xi+1)/2,(yi+1 + yi)/2) = 0 , i=1,..,N-1
- R(y1,yN) = 0 .
- This system is then solved by some standard solver like those
presented here in the chapter on linear and nonlinear equations. We use the damped Newton method,
which evaluates the Jacobian in each step.
The Jacobian of this system has a special sparse structure
A1,1 | A1,2 | O | O | ... | O |
O | A2,2 | A2,3 | O | ... | O |
... | ... | ... | ... | ... | ... |
O | ... | ... | O | AN-1,N-1 | AN-1,N |
JRya | O | ... | ... | O | JRyb |
Here
Ai,i = -I - (hi/2) JF((xi+xi+1)/2,(yi+1+yi)/2))
Ai,i+1 = I - (hi/2) JF((xi+xi+1)/2,(yi+1+yi)/2))
,
hi = xi+1 - xi .
JF denotes the Jacobian of F w.r.t. y and JRya,yb denotes the Jacobian of R w.r.t. to its two arguments ya, yb.
We take advantage of this structure by decomposing the first N-1 block rows separately and
exclude thereby the last block row from pivoting which comes into play only in decomposing the last
block row. This can introduce pivotal growth which therefore is reported in the results and can
be reduced by decreasing the stepsize hi (here by using a finer
initial grid for example). However, for problems with boundary singularities this might fail.
- This method converges for two times differentiable F and R (w.r.t. to x,y on
[a,b] × Rn) of second order in the
maximal grid size, which means that
||yi-y(xi)|| <= C × max{ xi+1-xi}2
with an unknown constant C depending on y(x), F, R.
- We allow a variable grid size here, determined by a requirement on the local error
like it is done in the step size control for initial value problems. We use here the
technique of local extrapolation for this: the same problem is solved a second time, on a
coherent grid with each subinterval didived in its middle. This results in a second solution
y{2}i, i=1,...,2*N-1. Assuming second order convergence
and an asymptotic development
yi = y(xi)+ (hi)2e1(xi) + O((hi)4)
(y{2}2i-1-yi)/3 = erri, i=1,...,N
is an asymptotically correct estimate of the error in yi.
y{2}2i-1+erri is the extrapolated solution
which should be fourth order accurate.
The user specifies two parameters tol and smally. Then we require that the
weigthed error estimate
yerrori = ∑j=1 to n |erri,j|/max(|y{2}2i-1,j|,smally)
satisfies
yerrori <= tol .
If this is not the case, then the current subinterval i is divided into up to 8 subintervals for the
next try. This is done in one sweep for all intervals. Thereby a new finer grid is obtained. The initial guess
for the solution on this new finer grid is obtained interval by interval using quadratic interpolation of
y{2},
since we have there three grid values
of this available in each interval.
|
|
- There is a choice between 6 different problems, of which the
analytical solution is known.
These are all scalar second order problems of the type
y'' = f(x,y,y'), g1(y(a),y'(a)) = 0, g2(y(b),y'(b)) = 0
rewritten as first order systems of dimension 2 by substituting
y1(x) = y(x), y2(x) = y'(x) .
You find the complete description of these cases
here .
You select a problem by clicking on the corresponding box.
- In case of problem 3, which has two solutions, you can select which one is desired.
- You select the number of grid points N by selecting N for the first
(equidistant) grid.
The grid size is then
h = (b-a)/(N-1)
- Here n=2 and we automatically select the two components of y for plotting results. Since these
components can have quite different sizes, each one is shown separately.
- Next you decide whether to use the predefined internal parameters
itmax, the maximum number of Newton steps in the solution process of
the discrete (non)linear system of equations, the required relative
precision tol for the solution of this system and a parameter smally
characterizing values of |yi| which should not enter the relative error criterion (with the absolute precision
requirement set to tol*smally) and printtable, which gives you the possibility
to get a printed table of the solution on the last fine grid, or to set these values as desired.
The default values are 30, 10-4, 0.1, false .
- You have the possibility to set the initial guess for the solution
of the system of equations yourself or to generate this internally. In the latter
case this initial guess is generated from the known analytical solution by disturbing
it by pseudo random errors controlled by a variable perturb. The largeness of the
perturbations is perturb × max(abs(y(xi))).
In the case of a linear problem (case 1) this plays no role since a linear system is solved
by Newtons method in one step irrespective of the initial guess, but in the other nonlinear
cases a large perturbation may cause considerable trouble.
|