Class QuadraticInterpolation
java.lang.Object
org.shredzone.commons.suncalc.util.QuadraticInterpolation
Calculates the roots and extremum of a quadratic equation.
-
Constructor Summary
ConstructorDescriptionQuadraticInterpolation
(double yMinus, double y0, double yPlus) Creates a new quadratic equation. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of roots found in [-1 ..double
getRoot1()
Returns the first root that was found.double
getRoot2()
Returns the second root that was found.double
getXe()
Returns X of extremum.double
getYe()
Returns the Y value at the extremum.boolean
Returns whether the extremum is a minimum or a maximum.
-
Constructor Details
-
QuadraticInterpolation
Creates a new quadratic equation.- Parameters:
yMinus
- y at x == -1y0
- y at x == 0yPlus
- y at x == 1
-
-
Method Details
-
getXe
Returns X of extremum. Can be outside [-1 .. 1].- Returns:
- X
-
getYe
Returns the Y value at the extremum.- Returns:
- Y
-
getRoot1
Returns the first root that was found.- Returns:
- X of first root
-
getRoot2
Returns the second root that was found.- Returns:
- X of second root
-
getNumberOfRoots
Returns the number of roots found in [-1 .. 1].- Returns:
- Number of roots
-
isMaximum
Returns whether the extremum is a minimum or a maximum.- Returns:
true
: Extremum at xe is a maximum.false
: Extremum at xe is a minimum.
-