Module Cgr.Eqn


module Eqn: Cgr_eqn
Solving non-linear equations of degree 2, 3 or 4.


Solving non-linear equations. This module is still in development.
type solution = [ `Complex of Complex.t | `Real of float ] 
val print_check : (string -> unit) Pervasives.ref
This variable is used to store a print function used to print checks on results. Default does nothing.
val solve_deg_2 : float * float * float -> solution * solution
Solving (a X^2 + b X + c = 0.0)
Returns the two solutions
val solve_deg_3 : float * float * float * float ->
solution * solution * solution
Solving (a X^3 + b X^2 + c X + d = 0.0)
Returns the three solutions
val solve_deg_4 : ?imeps:float ->
?compeps:float ->
float * float * float * float * float ->
solution * solution * solution * solution
Solving (a X^4 + b X^3 + c X^2 + d X + e = 0.0)
Returns the four solutions
imeps : (for imaginary epsilon); by default it is 0.000001 and is used to consider that a solution is real if the imaginary part of the solution is between - imeps and +imeps.
compeps : (for comparison epsilon); by default it is 0.00000000001 and is used to consider that a number is 0.0 if it is between - compeps and +compeps. It is used in two comparisons depending on the form of the equation.