This is part of the HicEst documentation
ROOTS: Quadratic Equations and Cubic Equations
Roots provides algebraic solutions for quadratic and cubic equations.
⇾Home
⇾Contents
⇾more Numerics
⇾ Examples
Bookmarks:
⇾cubic_equations
⇾quadratic_equations
solve
quadratic_equations
A*x
2
+ B*x + C = 0:
real_roots = ROOTS(ABCvector, quadratic_roots [, *errorLabel])
real_roots = number of real roots found
REAL
:: ABCvector(3), quadratic_roots(2)
ABCvector = (A, B, C)
optional: *errorLabel
⇾ on error jump to label
Example: x
2
- x + 6 = 0
DIMENSION
ABC(3), sqare_roots(2)
! define the 2 vectors
ABC = ( 1, -1, 6 )
found = ROOTS( ABC, sqare_roots )
! sets real_roots=2 and sqare_roots = (3, -2)
solve
cubic_equations
A*x
3
+ B*x
2
+ C*x + D = 0:
real_roots = ROOTS(ABCDvector, cubic_roots [, zero_discriminant [, *errorLabel]])
real_roots = number of real roots found
DIMENSION
ABCDvector(4), cubic_roots(3)
ABCDvector = (A, B, C, D)
optional: zero_discriminant (default 1E-10)
ROOTS uses Cardano's method. There will be 3 real roots if discriminant is less than this value
optional: *errorLabel
⇾ on error jump to label
in 1225
Leonardo of Pisa
found the root of
x
3
+ 2*x
2
+ 10*x - 20 = 0
to be 1 .368808107. Nobody knows by what method he achieved that.
HicEst
does it by
ABCD = (1, 2, 10, -20)
found = ROOTS(ABCD, cubic_roots, 1E-14, *999)
! found=1 and cubic_roots(1) = 1.368808107
⇾
Support HicEst
⇾
Impressum
©2000-2019 Georg Petrich, HicEst Instant Prototype Computing. All rights reserved.