Docsity

ALGEBRAIC EQUATIONS, Summaries of Differential Equations

Toggle sidebar
bg1
THE SIMULTANEOUS NUMERICAL SOLUTION OF
DIFFERENTIAL - ALGEBRAIC EQUATIONS*
C. W. Gear**
Stanford Linear Accelerator Center
Stanford University, Stanford, California 94305
and
Computer Science Department
Stanford University, Stanford, California 94305
(To appear in IEEE Trans. on Circuit Theory.)
*Supported in part by the U. S.
** On leave from University of
Atomic Energy Commission
Illinois at Urbana, Illinois.
SLAC-PUB-723 (Revised)
August 1970
mw
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pff
pf12
pf13
pf14
pf15
pf17
pf18
pf19
pf1a

Partial preview of the text

Download ALGEBRAIC EQUATIONS and more Summaries Differential Equations in PDF only on Docsity!

THE SIMULTANEOUS NUMERICAL SOLUTION OF

DIFFERENTIAL - ALGEBRAIC EQUATIONS*

C. W. Gear** Stanford Linear Accelerator Center Stanford University, Stanford, California 94305 and Computer Science Department Stanford University, Stanford, California 94305

(To appear in IEEE Trans. on Circuit Theory.)

Supported* in part by the U. S. On leave from University of

Atomic Energy Commission Illinois at Urbana, Illinois.

SLAC-PUB-723 (Revised) August 1970 mw

ABSTRACTABSTRACT

and algebraic equations of the type that commonly occur in the transient analysis of large networks or in continuous system simulation. The first part of the paper is a brief review of existing techniques of handling initial value problems for stiff ordinary differential equations written in the standard form y’ = f(y, t).

ThisThis paperpaper discussesdiscusses a unifieda unified methodmethod forfor handlinghandling the mixedthe mixed differentialdifferential and algebraic equations of the type that commonly occur in the transient analysis of large networks or in continuous system simulation. The first part of the paper is a brief review of existing techniques of handling initial value problems for stiff ordinary differential equations written in the standard form y’ = f(y, t). In the second partIn the second part one of theseone of these techniquestechniques isis appliedapplied to the problemto the problem F(y, y’,F(y, y’, t) = 0.t) = 0. ThisThis maymay be eitherbe either a differentiala differential oror an algebraican algebraic equationequation as dF/ayas dF/8y isis non-non- zerozero oror zero.zero. ItIt willwill representrepresent a m.ixed systema m.ixed system when vectorswhen vectors zz and xand x representrepresent componentscomponents of a system.of a system. TheThe methodmethod lendslends itselfitself to the use of sparseto the use of sparse matrixmatrix techniquestechniques when the problemwhen the problem is sparse.is sparse.

The properties of the D-A E’s typically encountered are: Differential Equations Large Sparse Stiff Algebraic Equations Large Sparse Mildly Nonlinear By sparse we mean that only a few of the variables w and 2 appear in any one of the functionsf org. Stiff^ means^ that^ there^ are^ greatly^ differing^ time^ constants present, or in other words that the eigenvalues of aw’/aw with 2 = -w are widely spread over the negative half plane. They are mildly nonlinear in that many of the algebraic variables only appear linearly and that the nonlinearities cause the Jacobians of the system 8(&$/a&,:) to change by only a small amount for small changes in the dependent variable. In regions where the dependent variables are changing rapidly, it is typically necessary to use small integration time steps to follow the solution, so only small changes in the Jacobians occur over each time step.

I A further^ complication^ that^ can occur^ in some problems^ is that^ the derivatives 1’ occur implicitly in equations of the form F&,w’,~, t) = 0. (This complication does not occur in network analysis since techniques have been developed to generate equations in which the derivatives are explicit, although the fact that explicitness is no longer necessary does raise the question of whether the manipulation neces- sary to put them in this form is worth the effort. )

In order to portray the characteristics of the general problem, we represent

it by the set of s equations 0 = I.&p, t) + Pv (^) (5) rather than the set (2). In Eq. (5) the s dependent variables w plus ,u have been replaced by the s variables 2 plus 1. .I represents the set of s2 variables that only appear linearly without derivatives. P is^ an s by s2 matrix^ of constants, while J is the remaining set of s1 = s - s2 variables. It is not always convenient to solve (5) for x1 to get form (2) for several reasons. Among these are: (i) The x1 may appear nonlinearly, and hence a numerical solution may’ require considerable computer time at each step, (ii) The solution may be ill-conditioned for y1 (indeed,, for stiff equations it frequently is), (iii) Writing the equations in form (2) may destroy the sparseness and hence increase solution time. Suppose that we can partition P by row interchanges into an s1 by s2 matrix P, I and an s,Y by s,Y matrix P,P which is nonsingular, and that the matching partition of H is l-I1 and I$2 where-

1 (This is possible if the system (5) has a unique solution.) We can then solve for v and write the reduced system as

0 = q&Y’, t) - PIP2 -1Hz&~‘, t) = ,JQ& t) (7)

wn it gave to Eq. (9) converged to 0 as n tended to infinity whenever Re(hi) < 0 and the time increment h was fixed and strictly positive. He proved that the ..J (^) maximum order of an A-stable multistep method was 2, and that the A-stable

method of order 2 with smallest error coefficient was the trapezoidal rule. (^) For many problems, second order accuracy is not adequate, so we must relax the Dahlquist A-stability criteria if multistep methods are to be used. For the remainder of this section we will only discuss w1 = f(w, t). All comments are applicable to systems. The nature of the problem that arises and the way in which it can be solved is illustrated in Figs. 1 and 2. (^) Figure 1 shows the application of the Euler method wn = w (^) n-l + h f(wn (^) - 1t tnpl) to the equation w’ = h(w - F(t))+F’(t) (^) (10) where h is a very negative constant and F(t) is a slowly varying function. Some of the members of the family of solutions are shown in Fig. 1. The Euler method projects the tangent at time tn l to time tn. (^) Because h is so negative, small per- turbations from the solutions which tend rapidly to F(t) are amplified rapidly unless h is very small. In fact, the error amplification is a factor of (1 + M) at each step so that hh must be greater than -2. (^) Figure 2 shows the backward Euler method which is given by W (^) n =w n-l + h f(Y,’ $J (11) In this method the implicit Eq. (11) must be solved for wn at each step. It is equivalent to finding the member of the family of solutions for which the tangent at tn passes through (wn 1, tn (^) _ 1 ). The error is amplified by l/(1 - M) at each step, and so it is stable when hh is in the negative half plane. (^) Any method that is to be stable for arbitrarily negative h must be implicit, or equivalently, make explicit use of the Jacobian. Methods that are A-stable include the Implicit

Runge Kutta (Ehle) , 2 the methods due to Rosenbrock, 3 Calahan4 and Allen5 which are extensions of the Runge-Kutta methods that make direct (^) ,use of the Jacobian, and the methods of the form W (^) n =w n-l + aIh(wk + wLml) + a2h2(w; - wCl) +... (^) > (12)

which are of order 2q. The application of these methods is a major computing task for large systems and is not generally practical. An alternative to requiring A-stability was proposed in Gear. (^6) It was sug- gested that stability was not necessary for values of M close to the imaginary axis but not close to the origin. These correspond to oscillating components that will continue to be excited in nonlinear problems. It will therefore be necessary to reduce h such that successive values of tn occur at least about 10 times per cycle. Methods that were stable for all values of M to the left of Re(M) = -D where D was some positive constant, and accurate close to the origin as shown in Fig. 3 were said to be stiffly stable. (^) The multistep methods of order k given by

W n = alwn-l +... + akwn-k + q-p:, (13)

were shown to be stiffly stable for k 5 6 in Ref. 6. The oi and PO are uniquely determined by the requirement that the order be k. Unfortunately Eq. (13) is an implicit equation for wn since w; = f( wn, tn). (^) In the case that af/aw is large the conventional corrector iteration will not converge. However a Newton iteration can be used. (^) If the first iterate is obtained from an explicit predictor formula, few iterations are needed. Furthermore, the first iterate can be made arbitrarily accurate by choosing h small enough. (^) Since Newton’s method is locally convergent, we are guaranteed that we will get convergence for

where g= (^) [ p,, 1, 0,... .0 T I.

B=

. 81 - Pl z,...z (^) k-l i zk y1 1 y2 ‘*” yk-1. Yk 1 0 0. ..o 0 0 0 1. ..o 0

.. (^) * 0 -‘...l, (^0) . and b = (^) [ hf(w,, tn) - hEh 1 is a scalar such-that (15) satisfies hf(wn, tn) - hw’ = 0. (Here hwh is the second component of U+ given by (15). ) We can subject (14) and (15) to nonsingnlar linear transformations. (^) In particular, if we note that the com- ponents of gn represent a unique polynomial Wn(t) of degree k such that Wn(tnmi) = W ., 0 <,i < k, and W;(tn) = wh, we can find the transformation which gives the components of a-n = (^) IIwn, hwh, h2w’&‘2,... , hkw(nk)/‘k! 1 T (^) representing the same polynomial. If this transformation is Q we have gn=QC&=QBQ -1 an-1 = A an,

-na^ =Qw-t-n =Qgn+Qcb=zn+Jb^ (16) where A = Q B Q-l *1s shown to be the Pascal triangle matrix in Ref. 7, and the values of 11= Q c are given in Ref. 6 for stiff methods of various orders. We can determine b from 0 = h f(w,, tn) - hwh = Fen, tn) (by definition) = F(Zin -+a b, tn)

If this is solved by .a Newton iteration starting from b(0) = 0, we get

b(m+l) = b(m) -^ [-w(m)vdb 1 -’^ F’btrn$, where p(b) = F(ZX +a b, tn)

(18)

Writing

we get -gn, (0) = A&l

%t, (m+l) = %, (m) -4 [go q “ij Fen,(m)’ tn) (19)

where ai is the ith (^) component of a, numbering from 0. We now note that this technique is not dependent on,the differential equations being written in the explicit form (1). It can be applied directly to F(s, t) = K(w, w’, t) = 0 provided that approxi- mations to the Jacobians can be found. Errors in these approximations do not affect the error in the numerical’solution, they only effect the rate of convergence of (19).

III. ALGEBRAIC EQUATIONS If Eqs. (2) are to be solved by the implicit algorithm (13)) we must solve the simultaneous algebraic system %I = alwnll^ -t... + akq,.k^ + h PO ftxn,zn,^ trill

0 = gtq&y tnl

for xn and zn at each step. Calahan’. and Hachtel g 1.) 10 do this by a simultaneous Newton iteration, The interesting and useful point to be brought out in this section is that it is not necessary to distinguish between the algebraic and differential variables, so that system (5) can be handled directly. 10 -

.En-l= n-l,hu;ml,.^. .,hkuEl/x]T.^ When we apply^ the appropriate^ linear^ trans-

formation S to obtainan 1 = S ~~-1 we have from (20) 3.-n=^ Sgn=^ S E S-‘za+ and from (21) 1 -% = i&^ + S e .b The matrix S E S-l is* the Pascal triangle matrix A and the vector S 2 is identical to the vector1 (see Ref. 11) so these equations are identical to Eq. (16) derived for differential equations. Therefore,^ iteration^ (19) cau be used to solve^ Eqs.^ (22) and (23) for b if we identify G with F. (They^ are^ both functions^ of t and the first component of 2 only, namely un or wn respectively.) IV. MIXED SYSTEMS The equation Fe, t) = K(w, WI, t) = 0 is a differential equation if BK/@w’ f 0, otherwise it is an algebraic equation. Because the above techniques for differential and algebraic equations are identical, it is not necessary to distinguish in the cases. The fact that the Jacobian dK/dw’ = haF/dal appears in (19) causes the method to adjust appropriately. If the system (7) is to be solved, we handle it as follows. Let the ith components of 2 and x1 be carried along with higher order derivatives as a”, 1 I i 5s. We write the jth equation from (7) as Fj( $1 , t) = 0 The prediction step is -na1 = A a’ -n- 1

and the Newton corrector iteration (19) is

We know that by choosing sufficiently small h, the predictor can be made arbitrarily accurate for both algebraic and differential variables, so, for small enough h, we will be within the region of convergence of Newton’s method. The linear system (24) must be solved for each correction iteration. (^) If the Jacobians are sparse, appropriate techniques can be used (see Hachtel (^) --et al., 10 ). If, as is common, they are slowly varying, they need not be re-evaluated at each iteration, although Calahan’ suggests that it is valuable to evaluate them immediately after each prediction step. It is possible to avoid the work of predicting the first approximation of the linear variables 1 in (5). Initial errors in v-n, t 0) do not affect the corrector itera- tion for the nonlinear algebraic or differential equations. (^) This can be seen by considering the partition used to get (6) and (7). Iteration (24) will take the form

3, %l %

--%I-

‘0 + w-6’1’ h p^10 I

p2Qo 1

=-pO

39,~‘, t) + 351

where Ax, = 1 n, tm+l) (^) - En, (3 and Ax is similar. Premultiply this by

plp I

small corrections are obtained, the differences between the predictor and corrector are used as estimates of the single step truncation error. If this is larger than a user supplied parameter, the step is reduced by an amount dependent on the order, and the step is repeated. If the error is acceptable, the step sizes that could be used for this order, one order higher, and one order lower are estimated. The largest of these is chosen for the next step, and the appropriate order is selected. Details of this and many other minor problems that must be handled in a practical integration algorithm are similar to those in the package given in Ref. 8 for dif- ferential equations, and described in Ref. 12. VI. A NUMERICAL EXAMPLE The following example is “artificial” in that it is not derived from a network. Rather it consists of a set of stiff differential equations coupled to a set of dif- ferential and algebraic equations. These have been chosen because enough of the solution is known to permit checking of the answers, and because they illustrate the features of the method. A system of four differential equations has been proposed by Krogh (private communication) to test stiff equations. They^ are^ given^ by: 4

0 = y’i - s + (r - yi)2 + c bij yj for i = 1 to 4 (26)

j=l where r = (Y, + y2 + y3 + ~~ 4 s = C (r - ~~)~/ i=l

and bij is a symmetric matrix with b 11 = bzz = b33 = b44 = 447. b12 = -b34 = bzl = -b43^ = -452.

b13 = -b24^ = b31 = -b42^ = -^ 47. b14 = -b23 = b41 = -b32 = - 52. Their solution is given by yi = p - zi where p = (zl -!- z2 -t z3 -I- z*)/ and zi = Pi/(1 +!$i’) (This is the solution of zi = zf - pizi. ) The starting conditons are yi = -1, so that ci = -(l + pi). (The values of pi used are P, = 1000,^ p2 = 800,^ p,^ = -10,^ and p4 = 0.001. ) As t tends to infinity the eigenvalues of the system approach - 1pi I. To this system we add the four equations 0 = Y; + YlY;; + YiY 0 = 2y6 + y; - y1+ v1 -l-emt=F 0 = v1 (^) - v2 + YlY6 = F 0 = v1 + v2 + 5yly2 = F8 (^) (27) with the initial conditions y5 = y6 = 1, v1 = -2,^ and v2 = -3.^ It^ is not immediately evident whether these represent differential equations for y5, y6, or both! In fact they were chosen so that the first of these equations can be integrated to give 0 = Y5 + Y& = F5 (28) The system of 8 Eqs. (26) and (27) have been integrated by the technique described. The maximum error in yl to y4 and the residuals F5 to F8 are shown in Table I

The method is similar to that used in Refs. 9 and 10, in fact the method for differential equations is identical. However this method has the advantage that the same technique is applied to both algebraic and differential variables, making it unnecessary to distinguish between them. This has important consequences for continuous system simulation, and can have consequences for network analysis since it will no longer be necessary to manipulate the equations into a “text book” form.

REFERENCESANDFOOTNOTES

G. Dahlquist, B. I. T. 3, 27-43 (1967). B. L. Ehle, B.I.T. S, 276-278 (1968). H. H. Rosenbrock, Comp. J. 5, 329 (1963). D. Calahan, A stable accurate method of numerical integration for nonlinear systems, ‘ IEEE Proceedings, p. 744 (1968). R. H. Allen, llNumerically stable explicit integration techniques using a linearized Runge-Kutta extension, ‘t Boeing^ Scientific^ Laboratories^ Document dl-82-0929 (1969). C. W. Gear, “The automatic integration of stiff ordinary differential equations, I Information Processing 68. Ed. Morrell, (North Holland Publishing Co. , Amsterdam, 1969); p. 187-193. C. W. Gear, Math. Comp. 21, 146-156 (1967). C. W. Gear, “An algorithm for the integration of ordinary differential equations, I’ (to appear in C. A. C. M., in the Algorithms section). D. Calahan, “Numerical considerations in the transient analysis and optimal design of nonlinear circuits, It Digest Record of Joint Conference on Mathematical and Computer Aids to Design, ACM/SIAM/IEEE, (1969). Hachtel, Brayton and Gustavson, “The sparse tableux approach to network analysis and design, It this issue. That the matrices Q B Q-1^ and S E S-1^ are both the Pascal triangle matrix A follows from the fact that B and E represent the highest possible order (k) extrapolation process possible in their respective representations, as does A. They must, therefore, be equivalent. For small E the differential equation EW’ = f(w, t) is stiff. The limit of this as f tends to 0 is the algebraic equation 0 = f(w, t). If we take the limit of the