The functions described so far involve finding the solution to an nth order differential equation when you know the value of the solution and its first n – 1 derivatives at the beginning of the interval of integration. This section discusses what happens if you don’t have all this information about the solution at the beginning of the interval of integration but you do know something about the solution elsewhere in the interval. In particular:
• You have an nth order differential equation.
• You know some but not all of the values of the solution and its first n – 1 derivatives at the beginning of the interval of integration, xl.
• You know some but not all of the values of the solution and its first n – 1 derivatives at the end of the interval of integration, x2.
• Between what you know about the solution atxl and what you know about it atx2, you have n known values.
When this is the case, you should use sbval to evaluate the missing initial values at xl. Once you have these missing initial values, you will have an initial value problem rather than a two-point boundary value problem. You can then proceed to solve this using any of the functions discussed earlier in this chapter.
The example in Figure 16-7 shows how to use sbval. Note that sbval does not actually return a solution to a differential equation. It merely computes the initial values the solution must have in order for the solution to match the final values you specify. You must then take the initial values returned by sbval and solve the resulting initial value problem as discussed earlier in .
The sbval function returns a vector containing those initial values left unspecified at xl. The arguments to sbval are
A vector-valued function having the same number of elements as v. Each element is the difference between an initial condition at x2, as originally specified, and the corresponding estimate from the solution. The score vector measures how closely the proposed solution matches the initial conditions at x2. A value of 0 for any element indicates a perfect match between the corresponding initial condition and that returned by sbval
It’s also possible that you don’t have all the information you need to use sbval but you do know something about the solution and its first n – 1 derivatives at some intermediate value,:if. This is the exactly the situation contemplated by bvalfit.
This function solves a two-point boundary value problem of this type by shooting from the endpoints and matching the trajectories of the solution and its derivatives at the intermediate point.
Partial differential equations
second type of boundary value problem arises when you are solving a partial differential equation. Rather than fixing the value of a solution at two points as was done in the previous section, we now fix the solution at a whole continuum of pointsrepresenting some boundary,
Two partial differential equations that arise often in the analysis of physical systems are Poisson’s equation:
and its homogeneous form, Laplace’s equation,
Mathcad has two functions for solving these equations over a square boundary, You should use the relax function if you know the value taken by the unknown function u (x, y) on all four sides of a square region.
If u(x, y) is zero on all four sides of the square, you can use multigrid function instead. This function will often solve the problem faster than relax, Note that if the boundary condition is the same on all four sides, you can simply transform the equation to an equivalent one in which the value is zero on all four sides.