Cubic equations
This article summarizes the theory behind the concepts represented in the module ompy.cubic, explained in post /documentation-ii.
seen from United States

seen from Canada
seen from United States
seen from Libya
seen from United States
seen from United States
seen from China

seen from Malaysia

seen from Malaysia
seen from United States

seen from United Kingdom
seen from China
seen from United States
seen from China
seen from Germany

seen from China

seen from Belgium
seen from United States
seen from China
seen from Japan
Cubic equations
This article summarizes the theory behind the concepts represented in the module ompy.cubic, explained in post /documentation-ii.
Documentation II
Full documentation can be found on https://ompy.tumblr.com/documentation
cubic
Analysis for cubic equations (for now, to be developed).
cbrt(radicand) Calculates the real cubic root -principal value- of rational representations of real numbers.
Parameters: radicand: int, float; required. Number to take the root of.
Returns: float; cubic root.
Examples:
>>> import ompy.cubic as cb >>> cb.cbrt(216) 6.0 >>> cb.cbrt(-27.0) -3.0 >>> cb.cbrt(10) 2.154434690032
to_depressed(a, b, c, d) Transforms a general cubic equation to a depressed cubic equation. It takes general equation coefficients 'a', 'b', 'c', 'd' and returns depressed equation coeffcients 'p', 'q'.
Parameters: a: int, float; required (it cannot be 0).
b: int, float; required.
c: int, float; required.
d: int, float; required.
Returns: tuple.
[0]: coefficient 'p'.
[1]: coefficient 'q'.
Examples:
>>> import ompy.cubic as cb >>> cb.to_depressed(1, -3, -3, 1) (-6.0, -4.0) >>> cb.to_depressed(1, 1, 1, 1) (0.6666666666666667, 0.7407407407407407) >>> cb.to_depressed(1, 0, 2, 3) (2.0, 3.0) >>> cb.to_depressed(2, 0, 0, 0) (0.0, 0.0)
cbdelta(p, q) Calculates the cubic discriminant (delta) for a depressed cubic equation
Parameters: p: int, float; required. Coefficient 'p' from depressed equation.
q: int, float; required. Coefficient 'q' from depressed equation.
Returns: float. Cubic delta number.
Examples:
>>> import ompy.cubic as cb >>> cb.cbdelta(3, 4) 20.0 >>> cb.cbdelta(-3, -2) 0.0 >>> cb.delta(5.55555, -4.44444) -5.6495085912265
depressed_roots(p, q) For depressed cubic equations returns a tuple with its roots.
Parameters: p: int, float; required. Coefficient 'p' from depressed equation.
q: int, float; required. Coefficient 'q' from depressed equation.
Returns: tuple; equation roots.
[0] : str; first root, represents a real number. [1] : str; second root, represents a real or complex number. [2] : str; third root, represents a real or complex number.\
Examples:
>>> import ompy.cubic as cb >>> cb.depressed_roots(-3, -2) ('2.0', '-1.0', '-1.0') >>> cb.depressed_roots(1, 0) ('0.0', '-0.0 + 1.0i', '-0.0 - 1.0i') >>> cb.depressed_roots(0, 1) ('-1.0', '0.5 + 0.86602540378i', '0.5 - 0.86602540378i') >>> cb.depressed_roots(1.11111, 2.22222) ('-1.02650941551', '0.513254707755 + 1.37891304479i', '0.513254707755 - 1.37891304479i')
roots(a, b, c, d) Calculates cubic general equations roots.
Parameters: a: int, float; required (it cannot be 0). Equation coefficient 'a'.
b: int, float; required. Equation coefficient 'b'.
c: int, float; required. Equation coefficient 'c'.
d: int, float; required. Equation coefficient 'd'.
Returns: tuple; equation roots.
[0] : str; first root, represents a real number. [1] : str; second root, represents a real or complex number. [2] : str; third root, represents a real or complex number.
Examples:
>>> import ompy.cubic as cb >>> cb.roots(1, -15, 75, -125) ('5.0', '5.0', '5.0') >>> cb.roots(2, -3, -11, 6) ('3.0', '-2.0', '0.5') >>> cb.roots(1, 2, 3, 4) ('-1.6506291914', '-0.1746854043 + 1.5468688872i', '-0.1746854043 - 1.5468688872i') >>> cb.roots(3, 0, 0, 0) (0.0, 0.0, 0.0)