正在加载图片...
5.6 Quadratic and Cubic Equations 185 in terms of which the three roots are E1=-2VQcos a 3-3 E2=-2VQcos 0+2π - (5.6.12) 3 3 =-2VQcos 8-2m 、3 - (This equation first appears in Chapter VI of Francois Viete's treatise "De emen- datione,"published in 1615!) Otherwise,compute 菲 A--R+VR-Q35 (5.6.13) where the sign of the square root is chosen to make 2d州 Re(R*VR2-Q3)≥0 (5.6.14) (asterisk again denoting complex conjugation).If Q and R are both real,equations (5.6.13)-(5.6.14)are equivalent to A=-sgn(R) (5.6.15) 9 where the positive square root is assumed.Next compute B={8A (A≠0) (A=0) (5.6.16) IENTIFIC( in terms of which the three roots are 1=4+B)-号 (5.6.17) (the single real root when a,b,c are real)and =1+-营+ 1 2(A-B) 10521 (5.6.18) Numerical 有=一4+-景-9A- 1 431 (outside Recipes (in that same case,a complex conjugate pair).Equations(5.6.13)-(5.6.16)are arranged both to minimize roundofferror,and also(as pointed out by A.J.Glassman) to ensure that no choice of branch for the complex cube root can result in the North spurious loss of a distinct root. If you need to solve many cubic equations with only slightly different coeffi- cients,it is more efficient to use Newton's method(89.4). CITED REFERENCES AND FURTHER READING: Weast,R.C.(ed.)1967.Handbook of Tables for Mathematics,3rd ed.(Cleveland:The Chemical Rubber Co.),pp.130-133. Pachner,J.1983.Handbook of Numerical Analysis Applications(New York:McGraw-Hill),$6.1. McKelvey,J.P.1984,American Journal of Physics,vol.52,pp.269-270;see also vol.53,p.775. and vol..55,pp.374-375.5.6 Quadratic and Cubic Equations 185 Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copyin Copyright (C) 1988-1992 by Cambridge University Press. Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) g of machine￾readable files (including this one) to any server computer, is strictly prohibited. To order Numerical Recipes books or CDROMs, visit website http://www.nr.com or call 1-800-872-7423 (North America only), or send email to directcustserv@cambridge.org (outside North America). in terms of which the three roots are x1 = −2 Q cos θ 3  − a 3 x2 = −2 Q cos θ + 2π 3  − a 3 x3 = −2 Q cos θ − 2π 3  − a 3 (5.6.12) (This equation first appears in Chapter VI of Fran¸cois Viete’s treatise “De emen- ` datione,” published in 1615!) Otherwise, compute A = −  R + R2 − Q3 1/3 (5.6.13) where the sign of the square root is chosen to make Re(R* R2 − Q3) ≥ 0 (5.6.14) (asterisk again denoting complex conjugation). If Q and R are both real, equations (5.6.13)–(5.6.14) are equivalent to A = −sgn(R)  |R| + R2 − Q3 1/3 (5.6.15) where the positive square root is assumed. Next compute B =  Q/A (A = 0) 0 (A = 0) (5.6.16) in terms of which the three roots are x1 = (A + B) − a 3 (5.6.17) (the single real root when a, b, c are real) and x2 = −1 2 (A + B) − a 3 + i √3 2 (A − B) x3 = −1 2 (A + B) − a 3 − i √3 2 (A − B) (5.6.18) (in that same case, a complex conjugate pair). Equations (5.6.13)–(5.6.16) are arranged both to minimize roundoff error, and also (as pointed out by A.J. Glassman) to ensure that no choice of branch for the complex cube root can result in the spurious loss of a distinct root. If you need to solve many cubic equations with only slightly different coeffi- cients, it is more efficient to use Newton’s method (§9.4). CITED REFERENCES AND FURTHER READING: Weast, R.C. (ed.) 1967, Handbook of Tables for Mathematics, 3rd ed. (Cleveland: The Chemical Rubber Co.), pp. 130–133. Pachner, J. 1983, Handbook of Numerical Analysis Applications (New York: McGraw-Hill), §6.1. McKelvey, J.P. 1984, American Journal of Physics, vol. 52, pp. 269–270; see also vol. 53, p. 775, and vol. 55, pp. 374–375.
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有