11"""
22shoot(phi,xspan,lval,lder,rval,rder,init)
33
4- Use the shooting method to solve a two-point boundary value problem. The ODE is
5- u'' = `phi`(x,u,u') for x in `xspan`. Specify a function value or derivative at
6- the left endpoint using `lval` and `lder`, respectively, and similarly for the
7- right endpoint using `rval` and `rder`. (Use an empty array to denote an
8- unknown quantity.) The value `init` is an initial guess for whichever value is
9- missing at the left endpoint.
10-
11- Return vectors for the nodes, the values of u, and the values of u'.
12- """
4+ Use the shooting method to solve a two-point boundary value problem.
5+ The ODE is u'' = `phi`(x,u,u') for x in `xspan`. Specify a function
6+ value or derivative at the left endpoint using `lval` and `lder`,
7+ respectively, and similarly for the right endpoint using `rval` and
8+ `rder`. (Use an empty array to denote an unknown quantity.) The
9+ value `init` is an initial guess for whichever value is missing at
10+ the left endpoint.
11+
12+ Returns vectors for the nodes, the values of u, and the values of
13+ u'.
14+ """
1315function shoot (phi,xspan,lval,lder,rval,rder,init)
1416
1517 # Tolerances for IVP solver and rootfinder.
@@ -46,11 +48,11 @@ function shoot(phi,xspan,lval,lder,rval,rder,init)
4648end
4749
4850"""
49- diffmat2(n,xspan)
51+ diffmat2(n,xspan)
5052
51- Compute 2nd-order-accurate differentiation matrices on `n`+1 points in the
52- interval `xspan`. Return a vector of nodes, and the matrices for the first
53- and second derivatives.
53+ Compute 2nd-order-accurate differentiation matrices on `n`+1 points
54+ in the interval `xspan`. Return a vector of nodes, and the matrices
55+ for the first and second derivatives.
5456"""
5557function diffmat2 (n,xspan)
5658 a,b = xspan
@@ -79,11 +81,11 @@ function diffmat2(n,xspan)
7981end
8082
8183"""
82- diffcheb(n,xspan)
84+ diffcheb(n,xspan)
8385
8486Compute Chebyshev differentiation matrices on `n`+1 points in the
85- interval `xspan`. Return a vector of nodes, and the matrices for the first
86- and second derivatives.
87+ interval `xspan`. Return a vector of nodes, and the matrices for the
88+ first and second derivatives.
8789"""
8890function diffcheb (n,xspan)
8991 x = [ - cos ( k* pi / n ) for k= 0 : n ] # nodes in [-1,1]
@@ -110,14 +112,14 @@ function diffcheb(n,xspan)
110112end
111113
112114"""
113- bvplin(p,q,r,xspan,lval,rval,n)
115+ bvplin(p,q,r,xspan,lval,rval,n)
114116
115- Use finite differences to solve a linear bopundary value problem. The ODE is
116- u''+`p`(x)u'+`q`(x)u = `r`(x) on the interval `xspan`, with endpoint function
117- values given as `lval` and `rval`. There will be `n`+1 equally spaced nodes,
118- including the endpoints.
117+ Use finite differences to solve a linear bopundary value problem.
118+ The ODE is u''+`p`(x)u'+`q`(x)u = `r`(x) on the interval `xspan`,
119+ with endpoint function values given as `lval` and `rval`. There will
120+ be `n`+1 equally spaced nodes, including the endpoints.
119121
120- Return vectors of the nodes and the solution values.
122+ Returns vectors of the nodes and the solution values.
121123"""
122124function bvplin (p,q,r,xspan,lval,rval,n)
123125 x,Dx,Dxx = diffmat2 (n,xspan)
@@ -138,16 +140,17 @@ function bvplin(p,q,r,xspan,lval,rval,n)
138140end
139141
140142"""
141- bvp(phi,xspan,lval,lder,rval,rder,init)
143+ bvp(phi,xspan,lval,lder,rval,rder,init)
142144
143- Use finite differences to solve a two-point boundary value problem. The ODE is
144- u'' = `phi`(x,u,u') for x in `xspan`. Specify a function value or derivative at
145- the left endpoint using `lval` and `lder`, respectively, and similarly for the
146- right endpoint using `rval` and `rder`. (Use an empty array to denote an
147- unknown quantity.) The value `init` is an initial guess for whichever value is
148- missing at the left endpoint.
145+ Use finite differences to solve a two-point boundary value problem.
146+ The ODE is u'' = `phi`(x,u,u') for x in `xspan`. Specify a function
147+ value or derivative at the left endpoint using `lval` and `lder`,
148+ respectively, and similarly for the right endpoint using `rval` and
149+ `rder`. (Use an empty array to denote an unknown quantity.) The
150+ value `init` is an initial guess for whichever value is missing at
151+ the left endpoint.
149152
150- Return vectors for the nodes and the values of u.
153+ Returns vectors for the nodes and the values of u.
151154"""
152155function bvp (phi,xspan,lval,lder,rval,rder,init)
153156 n = length (init) - 1
@@ -172,12 +175,12 @@ function bvp(phi,xspan,lval,lder,rval,rder,init)
172175end
173176
174177"""
175- fem(c,s,f,a,b,n)
178+ fem(c,s,f,a,b,n)
176179
177- Use a piecewise linear finite element method to solve a two-point boundary
178- value problem. The ODE is (`c`(x)u')' + `s`(x)u = `f`(x) on the interval
179- [`a`,`b`], and the boundary values are zero. The discretization uses `n` equal
180- subintervals.
180+ Use a piecewise linear finite element method to solve a two-point
181+ boundary value problem. The ODE is (`c`(x)u')' + `s`(x)u = `f`(x) on
182+ the interval [`a`,`b`], and the boundary values are zero. The
183+ discretization uses `n` equal subintervals.
181184
182185Return vectors for the nodes and the values of u.
183186"""
0 commit comments