UNIVERSITY OF ILLINOIS LIBRARY AT URBANA-CHAMPAIGN Digitized by the Internet Archive in 2013 http://archive.org/details/useofriccatiequa674triv y^ y 7y UIUCDCS-R-7 I )-67 J + The Use of Riccati Equation in Digital Computer Arithmetic by Kishor S. Trivedi August 1974 THE LIBRARY OF THE OCT 4 1974 UNIVERSITY OF ILLINOIS AT URB/ URBANA, ILLINOIS This volume Is bound without ■no.676,vol.i.A-L. which is/are unaval lable. lJUtiO IUCDCS-R-7 1 f-67 i + The Use of Riccati Equation in Digital Computer Arithmetic Kishor S. Trivedi August 1974 THE LIBRARY OF THE OCT 4 1974 UNIVERSITY OF ILLINOIS AT U r DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN URBANA, ILLINOIS UIUCDCS-R-T 1 )-^?^ The Use of Riccati Equation in Digital Computer Arithmetic by Kishor S. Trivedi August 197^ Department of Computer Science University of Illinois at Urb ana- Champaign Urbana, Illinois This work was supported in part by the National Science Foundation under Grant No. US NSF GJ 382 Ok. o/o. 1. INTRODUCTION It was demonstrated by DeLugish [1] that number representations other than the traditional positional notation are useful. This led to a search for new number representations. There seem to be several basic requirements for a proposed representation of numbers to be useful for implementation in hardware [2], These are the following: Requirement 1: Conversion to the conventional positional notation should be simple. Requirement 2 : The set of numbers representable should be a complete set [3]. In other words, the range of numbers representable should be an interval of the real numbers. Requirement 3 : It should be possible to define a broad class of algorithms that are easily soluble for the representation of numbers used. Hardware- compatibility among the algorithms is also desirable. Requirement h: For algorithms which require trial and error procedure, it should be possible to devise techniques such that the coefficient-selection is practical (cf., quotient-digit selection in division). For continued fractions, a simple conversion procedure to positional notation is well known [2,1+]. By an appropriate choice of the digit sets for the partial numerators and partial denominators, the requirement of completeness is satisfied [2,5]. The requirement of the identification of a broad class of algorithms seems to be a difficult problem. A limited class of quadratics can be solved using continued fractions [2], We will discuss a very powerful method by which continued fraction algorithms for many elementary functions and for the integration of many functions can be obtained. The requirement of an appropriate selection procedure is another difficult problem. For the solution of quadratics, a selection procedure has been obtained [2,5]. The use of Riccati equation for continued fraction arithmetic will be discussed in this report. We will first show the large number of functions that fit into this analysis. Later we will discuss the derivation of suitable selection procedures. The use of Riccati equation for this purpose was first proposed in [6] . 2. RICCATI EQUATION 2.0 Introduction Riccati equation can be written as : y' + a(x)y + b(x)y + c(x) = 0. (2.1) Let L be the set of all Riccati equations of this form. Wynn has shown that the set L is closed under the bilinear transformation y = p/(q+z) where p, q are constants [7]. Starting with £ e L, by a repeated application of the bilinear transformation, we can obtain a continued fraction expansion for the solution to the initial Riccati equation £ . Let £ Q be given by: y^ = a Q y Q + b Q y Q + c Q , and let y Q = P^/^+y^. Let this transformation be called T : L -* L. T (1 ) = ! is given by y{ + ^ y\ + b 1 y x + c x = 0. The recursion relations for the coefficients a , b , c in terms of a Q , b Q , c are, a i = c c/ p i' \ = b + 2 °0 V P l' / (2.2) c i = a o p i + b o q i + c o 4/ p i Note here that, we have changed the form of £ to avoid negative 2 signs in recursions (2.2). In general, let ^ = (y^ m - a 2m y 2m + b 2m y 2m + c 2m ) 2 and let £ n , _ = (y' , _ + a„ n y_ . + b_ . y , + c„ , = 0). Assume that, 2m+l w 2m+l 2m+l J 2m+1 2m+l ,/ 2m+l 2m+l y ' I = T T , ... T., (iL) has been obtained. Then the coefficients of n n n-1 l v I ., = T , (i ) are given by the following recursions: n+1 n+1 n a , , = c /p , , n+1 n n+1 b ,=13 +2c qn/p.n n+1 n n ti+1' ^n+1 c , = a p -,+b q _ + c q , /p i • n+1 n ^n+1 n n+1 n n+1 7 n+1 J As a result of these transformations, we have expanded y to n+1 terms as (2.3) follows p l p 2 p n+l Let P -i/Ql^ -i denote the finite continued fraction obtained by setting y = in equation (2.4). If we assume that |y | < M where M is a fixed constant then clearly, the fraction P /Q, converges to y . By setting, P_ =0, Q = 1, P_, = p n and Q_ = q_, , the recursions for P ., and Q n 11 \L 1 n+1 Ti+1 are [4] : P n =q n P+p n P, "> n+1 ^n+1 n ^n+1 n-1 I ( (2.5) Vl = Vl \ + P n+1 Vl J Thus if we have a method to correctly choose p , q for every n then, we have an algorithm to solve the Riccati equation. 2.1 Power of the Method We will now discuss the number of functions that can be obtained by the method of Riccati equation. 2.1.1 Constant Coefficients Let us consider a subset L of L such that 2 , L = {y' + ay + by + c = | a, b, c e R) i.e., the set of all Riccati equations with constant coefficients. Consider £ e L given by, 2 2 y 6 = a 7 + b y + °0* De P endin S on the si § n of A = b n - k a n c n , the 0' solution y n (x) of £ can be written as, v -L ■c\ if A < and a ^ 0; y W V 2a o ° jf A = 0, a n f 0; , (x) = ^ (tan „(§ x + A Q ) - ^) if A > 0, a Q ^ 0; b Q x y (x) = A Q e + c Q x if a Q = 0, Depending on the values of the coefficients a_, b , c and the initial condition t„ = y n (0), many different functions may be evaluated as shown in the following table. a o b o c o A *0 y W 1 1 -k tan x -1 -1 -k oo cot X -1 00 1/x -1 1 k 00 cot h x -1 1 h tan h x +1 >o 1 +x e— Table 2.1 2.1.2 Variable Coefficients Consider a subset L, of L so that, o 1^ = [y< = a (x) y + b(x) y + c(x)|a(x) = k(x) a, b(x) = k(x) b, c(x) = k(x) c, and a, b, c are constants). Recursions for a , , b , and c . can be derived from the recursions (2.3) n+1 n+1 n+1 v ' and are as follows : a.^ = c,/p -\ i+1 r -^i+1 b. _ = b. + 2c. q. ,/p. , 1+1 l i i+r *i+l - 2 'i+1 " "i ^i+l ' "i ^i+1 ' C i ^i+l' ^i+l' -, = a. p. , + b. q. n + c. q. ,/p. ,. (2.6) -2 Depending on the sign of A„= b - ^-a c , the solution to £ is given by: ^ \d y (x) = *b 2a, ^0 f (tan(— ^ Jk(x) dx + A ) --£=) s/- *0 if Aq < 0, a Q / 0: y» = - + A, a n k(x) dx 2a n if A Q = 0, a Q / 0; Yr A 2a (x) = - — ° (tan h(-^ /k(x) dx + A Q ) - -~r. J% if Aq > 0, a Q / 0; y (x) = A Q e |k(x) dx c - -^ if a Q = 0, b Q / 0; b and 7, } (x) = c Q Jk(x) dx + A Q if a o = b o = °' Clearly, a large class of functions can be evaluated with this method, 2.1.2.1 The Case With Aq = In this section, we will concentrate on a subset L of L such that, L, = {I € L JAq = 0}. Any £ e L can be rewritten as: y* = k(x)(a*y+b*) where, a* = v a, b* = a*(— ). With this modification, we have reduced the 2a number of coefficients from three to two. The recursions on a*, b* can now n n be written as follows : *\ a * _ t)-x-A/p n+1 ■ n ^n+1' K + i - < a S p n+ i + K w)^ n+1 J (2.7) The solution £ e L is given by, y (x) = (ag) 2 (A Q - j*k(x) dx) y Q (x) = (b*) 2 Jk(x) dx + A Q a 5 if a* / 0, if a* = 0. Note that, we can integrate the given function k(x) by this method by setting a* = and b* = 1. 8 2.2 Implementation Considerations Let us assume that simple selection procedures are available for all the functions to be evaluated as detailed in section 2.1. We now give steps of an algorithm T which will evaluate these functions. Algorithm T: Step 1 : [Initialize] Set P Q - 0, Q Q - 1, P_ 1 - 1, Q_ 1 - O; Set initial values of coefficients according to the function to be evaluated.; Set i - 0; Step 2 : [Select] (P- Tt % i ) "*" Select (x, coefficients, function); Step 3 '■ [Recursions] P i + i^ Vi p i + p i + i p i-i ; Vi - Vi \ + p i+ i \-i> Recur se using equations (2.3), (2.6) or (2.7) whichever is applicable. Step k : [Test] After 'sufficient' number of iterations GO TO Step 5; otherwise set i <- i+1, and GO TO Step 2; Step 5 : [ e valuat e ] y (x) = f(x) = R i+1 /Q i+1 ; END T; In any such iterative algorithm, the number of iterations required and the execution time required per iteration are two important considerations, In each iteration, steps 2, 3 and h are executed. Clearly, step 2 and 3 require more attention. We can assume that if the procedure Select is known, it can be implemented in a combinational network and therefore, will require very little time. In step 3, we see that all the assignments are independent of each other and therefore, can be executed in parallel. Thus, given sufficient hardware, step 3 can be speeded up considerably. Each individual recursion requires additions (subtraction), multiplications and sometimes division also. Since multiplication and division are relatively slower operations, we would like to avoid them if possible. If we restrict the coefficients p. and q. to be integral powers of two these multiplications and divisions will be reduced to shifts, which is relatively a faster operation. If we use the recursions (2.7), then we further require that p. = 1 for V i. For the sake of simplicity, we will assume that p. = 1 in every case and q. € S where, S = f 2 J I -j is an integer}. Since the l q ' q l ' J number of shifts available is finite we further require that, S = {2^11 < j < J ] where J and J are fixed integers, q l '-q - d - q J q -q & The number of iterations to be carried out can be decided on the basis of allowable error in the result. 2.3 Initial Condition Associated with the solution of any differential equation, there are one or more arbitrary constants which are evaluated using the boundary conditions imposed. Depending on the Function f(x) to be evaluated, we choose a particular £ e L (and the corresponding coefficient values) and the associated initial condition y n (0) = t so that y n (x) = f(x). Clearly, the initial condition on I. (i > l) is dependent on t . In particular, 10 y n-l = Vr/^V*^ WhiCh im P lies > t n=p/(q.+t) which implies, n-1 n in n t = p /t . - a (2.8) n r n' n-1 ti As we will see in Chapter 3, t is needed as an argument in a selection procedure for p and q ... Therefore, we need to evaluate t in every iteration. This, however, implies that a division be carried out. We can avoid the division by the following technique. Let t = d /e then, from equation (2.8), n n 7 n d P e n , n n-1 e , n n-1 From which, d = p e ,-qd .. n r n n-1 in n-1 (2.9) e = d ., n n-1 and d = t and e = 1. If the selection procedure can choose with the help of d and e n n (does not explicitly require t ) then we have solved our problem. Now in step 3 of algorithm T, we have to carry out recursions (2.9) as well. 2.k Convergence If the digit sets S and S are finite and positive then it can easily p q be shown that m < y < M V n, i.e., y is bounded [5]. The convergence P /0 to y n (x) can then be guaranteed if a correct selection procedure is available [5]. Therefore, we will discuss the question of selection procedure in the next chapter. 11 3. ATTEMPTS AT FINDING SELECTION PROCEDURES 3.0 Introduction It is quite clear that the selection procedure will be different for different functions. We will say that a selection procedure is consistent if at every step in the evaluation of a given function, the same selection procedure can be used. The definition of consistency implies that the function represented by y. (x) is independent of i. From the solutions of Riccati equation (given in Chapter 2), it is easy to see that this will be true if A. = A for V i. This can be shown as follows r8l : Let I. , e L and T. (£. . ) = £. 1 J l-l l l-l i then from recursions (2.3), we have, 2 A. = b. -'4a. c. 11 11 = (b. , + c. , q./p. ) i-I i-I r i - 4 — — (a. p. + b. q. + c. _ q./p. ) p. i-I i i-I n. i-I t/ i l ^2 ,,22/2,. / = b. + 4 c. 1 q./p. + 4 b. c. 1 q./p. i-I i-I r l i-I i-I t/ i 2 2 2 -4 a. , c. .. -4b. , c. , q_./p. -4c. , q_./p. i-I i-I i-I i-I ^i' *i i-I ^±'^2. 1.2 , = D. _ - 4 a. , c. , i-I i-I i-I "\-r Thus we have shown that consistency requirement is satisfied. 12 We now fix the digit sets for the partial numerators and the partial t denominators. We will assume p. = 1 for all i. We will assume 1 S = {1, l/2, l/k) . Note that this is a redundant digit set. Such a redundancy is required for the selection procedure to be possible [5]. The set of all infinite continued fractions representable with this 1 digit set is the interval F = [0.39* 1-56]. Given v. e F and y. = - the constraint for choosing q. , is that q. , e S and y. n e F. Therefore, tL+1 l+l q J l+l ' if y. E F = [0.39, 0.72] then we can choose q^ = 1, if y. € Fp = [O.M35, 1.123] then we can choose q. .. = l/2, and if y. e F = [0.553, 1.56] then we can choose q. -, = l/^+. Quite clearly, the intervals F , F and F„ are not pairwise mutually disjoint, which shows the redundancy of the digit set S . In the intersection F, = F, fl F„, q. n can be chosen as either 1 or q 12 1 2 7 T.+1 l/2. Similarly, in the interval F p ~ = F p fl F„, q. , can be chosen as either 1/2 or l/h. Thus, if we know y n then we have a consistent method of expansion of y into an infinite continued fraction. Since y is not known in advance, this simple method will not work. 3.1 The Criteria for Selection For further discussion, we will concentrate on the subset L of L. 2 Consider i e L,_ given by: y' = j k(x) (a y +b ) where j = 1 if n is even 10 n nnn and j = -1 if n is odd. The solution to this equation is given by: A = j g(x) + — j — 1 r v (3.1) n d 6 ^ ' a (a y +b ) w ' nnn n Where, A is an arbitrary constant of integration and g(x) = / k(x) dx. A d can be evaluated by using the initial condition y (0) = t = — . Therefore, n n e n e n 1 A- = 3 g(°) + ~r~ i — 3 — tz \ • Substituting this value of A in equation (3.1), nd(ad+be) ° n n n n n n 13 we have, d + j(g(x)-g(0)) b (a d +b e ) ( ) n , , , n n n , y n U; ~~ e - j(g(x)-g(0)) a (a d +b e ) n n n n n n A S (k(x), a , b , d , e , j). (3.3) = n v v " n' n' n' n' J y VJ J; Quite clearly, if the function S can be evaluated accurately for every value of n then the selection procedure is trivial. But the computation of the function S is at least as complex as that of y (x). Therefore, this method is not useful. However, the redundant number representation may allow us to use an approximation S of S in the selection procedure. If the computation of S is simple enough then such a selection procedure will be practical. Let us denote z^ = sup. (F^), z^ = Inf. (F^), z = Sup. (Fpo) and _z p ~ = Inf. (F pc .). Further let z and z be suitable constants such that z e F-.p, z = F p „. We use the following selection procedure, Select 1. Select 1: If z.. < S < z then q. _ = l/2 : 1 — n — 2 T.+1 " ' else if S > z then q. - = l/k: n 2 T.+1 ' ' else if S < z n then q. _ = 1; n 1 H i+1 end Select 1; Clearly, Select 1 will be correct if the following condition is satisfied for all n. | S n - Sj < Min.fz^ - z ± , z^ - Zp, z ± - z^, Zp - Zp 3 ). (3.*0 Ik Therefore, we should try to find a sufficiently simple approximation S for S which satisfies the condition (3.*0. A linear approximation to S is perhaps the simplest. Further, if the coefficients in the linear approximation are powers of two then computation of S will involve addition and shift operations only. It may be noted that with S = {1, 1/2, l/l+}, F^ = [O.kQj, 0.72] and F_ = [0.553, 1.123]. If we let z = 0.5 and z^ = 0.75, then even if S is correct only to one digit, q can he chosen correctly. Before proceeding further, we choose a particular function to be -1 r 2 evaluated. We let y n (x) = Sin (x), k(x) = l/vl-x , a = 0, b = 1, d = 0, e Q = 1. 3.1.1 More Details For y n (x) = Sin" (x), -1 d + i Sin (x) b (a d +b e ) a n n n n n n fo >. n ~ ^1 / U-p; e - j Sin (x) a (a d +b e ) n n n n n n Therefore, S £ F no iff, n 12 ' (0.72 e -d ) n n' and Let jx < Sin( £ — ) 0.72 a d + (0.72 e +d )(a b ) + b e n n n n n n' n n (O.i+85 e n -d n ) jx > Sin( p * — ) (3.6) 0.^5 a d + (0.^85 e +d ) a b + b e nn nnnn nn s e - d M n (s) = Sin(— -£ S H __) sa d + (s e +d ) a b +be nn nnnn nn 15 The selection overlap regions can be given by: jx 6 [M n (0.i485), M n (0,72)] then q^ = l/2 or 1, and jx e [M n (0.553), M n (l.l23)] then q^ = l/^ or V 2 - Since the computation involved in M (s) is intolerable, we must find a simple approximation M (s) to M (s). If M (s) satisfies the condition (3.^0 then the selection procedure will be correct. There are several ways to obtain the approximation M (s). The first attempt consisted of trying to obtain a continuous linear least square fit for jx = M (s) which is linear in a , b , d , e. But this i o n \ j n n n n procedure involved the computation of a number of h- tuple integrals of functions which are inseparable in the variables of integration. Therefore, this approach was abaondoned. Second approach consisted of obtaining a tangential hyperplane to the surface jx = M (s) (for a fixed value of s) at some point in the 5 five dimensional space R . Unfotunately, after some computation, it was seen that for displacements in the 5-space, the tagential hyperplanes rotate by large angles. The third approach consisted in obtaining a discrete least square fit of jx = M (s). This approach also could not produce an approximation which will satisfy the error condition (3.*+). The growth of coefficients a , b , d , e seems to be the reason of n n n n failure. 16 k. CONCLUSION AND FUTURE RESEARCH The method of Riccati equation is a very powerful method. Countless number of functions can be evaluated in a uniform manner using this method. Obtaining a suitable selection procedure seems to be a very difficult problem. Further investigation for obtaining selection procedures is needed. Growth pattern of the coefficients of the Riccati equation need to be studied. Methods of scaling so as to control the growth of coefficients need to be investigated. 17 LIST OF REFERENCES [1] DeLugish, B. G. , "A Class of Algorithms for Automatic Evaluation of Certain Elementary Functions in a Binary Computer," Ph.D. Dissertation, University of Illinois, Urbana, June 1970; also Department of Computer Science Report 399. [2] Robertson, J. E. and K. S. Trivedi, "The Status of Investigations into Computer Hardware Design Based on the Use of Continued Fractions, " IEEE Transactions of Computers , Vol. C-22, No. 6, June 1973, pp. 555-560. [3] Goldberg, R. R., "Methods of Real Analysis, " Blaisdell Publishing Company, New York, 1965. [h] Wall, H., "Analytic Theory of Continued Fractions," Van Nostrand, Princeton, New Jersey, 1950. [5] Trivedi, K. S., "An Algorithm for the Solution of a Quadratic Equation using Continued Fractions," M.S. Thesis, University of Illinois, Urbana, June 1972; also Department of Computer Science Report 525- [6] Bracha, A., "Application of Certain Functions on a Digital Computer," University of Illinois, Urbana, Technical Report, UIUCDCS-R- 72-510. [7] Wynn, P., "On Some Recent Developments in the Theory and Application of Continued Fractions, " Journal SIAM on Numerical Analysis , Vol. 1, pp. 177-197, 196^. [8] Robertson, J. E., private communication. BIBLIOGRAPHIC DATA SHEET 1. Report No. . Kcport No. . , , UIUCDCS-R- 7^-67}+ 4. Title and Subtitle The Use of Riccati Equation in Digital Computer Arithmetic 3. Recipient's Accession No. 5. Report Date August 197^ 6. 7. Author(s) Kishor S. Trivedi 8. Performing Organization Rept. No. 9. Performing Organization Name and Address Department of Computer Science University of Illinois Urbana, Illinois 10. Project/Task/Work Unit No. 11. Contract /Grant No. GJ 382 Qh 12. Sponsoring Organization Name and Address National Science Foundation Washington, DC 13. Type of Report &• Period Coveted 14. 15. Supplementary Notes 16. Abstracts This is a report of ongoing research in continued fraction arithmetic, It is shown that a large number of functions can be evaluated using the Riccati differential equation. However, the problem of properly selecting the partial numerators and the partial denominators remains to be solved. Several attempts to obtain such selection procedures are described. Possible directions for further research are indicated. 17. Key Words and Document Analysis. 17o. Descriptors Combinational Network Computer Arithmetic Continued Fractions Function Evaluation Representation of Numbers Riccati Equation Selection Procedure 17b. Identifiers 'Open-Ended Terms 17c. COSAT! Field/Group 18. Availability Statement 19. Security Class (This Report) UNCLASSIFIED 21. No. of P-tf 1 • 20. Security Class (This Page UNCLASSIFIED 22. Price f-'ORM NTIS-35 (10-70) USCOWM-DC 40329-1 ffi . »tw m ?': < ; ' 1