Package org.moddingx.libx.util.math
Class DoublePolynomial
- All Implemented Interfaces:
DoubleFunction<Double>,DoubleUnaryOperator,Function<Double,,Double> UnaryOperator<Double>
public final class DoublePolynomial
extends Polynomial<Double>
implements DoubleUnaryOperator, DoubleFunction<Double>
A polynomial with double coefficients.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<DoublePolynomial> static final DoublePolynomialThe identity polynomial.static final DoublePolynomialThe polynomial that is always one.static final net.minecraft.network.codec.StreamCodec<ByteBuf, DoublePolynomial> static final DoublePolynomialThe polynomial that is always zero. -
Constructor Summary
ConstructorsConstructorDescriptionDoublePolynomial(double... coefficients) Creates a new polynomial with the given coefficients. -
Method Summary
Modifier and TypeMethodDescriptionadd(Polynomial<Double> other) Adds two polynomials together.apply(double x) Computes the value of the polynomial at the given input.Computes the value of the polynomial at the given input.doubleapplyAsDouble(double x) Computes the value of the polynomial at the given input.Gets the coefficients of this polynomial.Computes the derivative of this polynomial.booleaninthashCode()Integrates this polynomial with constant part 0.integrate(double constant) Integrates this polynomial with the given constant part.multiply(Polynomial<Double> other) Multiplies two polynomials.negate()Negates this polynomial.Methods inherited from class org.moddingx.libx.util.math.Polynomial
subtract, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.function.DoubleUnaryOperator
andThen, compose
-
Field Details
-
CODEC
-
STREAM_CODEC
-
ZERO
The polynomial that is always zero. -
ONE
The polynomial that is always one. -
IDENTITY
The identity polynomial.
-
-
Constructor Details
-
DoublePolynomial
public DoublePolynomial(double... coefficients) Creates a new polynomial with the given coefficients.new DoublePolynomial(2,0,1)gives for example the polynomial2x²+1.
-
-
Method Details
-
coefficients
Description copied from class:PolynomialGets the coefficients of this polynomial. For example, the coefficients[2, 0 1]represent the polynomial2x²+1.- Specified by:
coefficientsin classPolynomial<Double>
-
applyAsDouble
public double applyAsDouble(double x) Computes the value of the polynomial at the given input.- Specified by:
applyAsDoublein interfaceDoubleUnaryOperator
-
apply
Computes the value of the polynomial at the given input.- Specified by:
applyin interfaceDoubleFunction<Double>
-
apply
Computes the value of the polynomial at the given input. -
derivative
Description copied from class:PolynomialComputes the derivative of this polynomial.- Specified by:
derivativein classPolynomial<Double>
-
integrate
Integrates this polynomial with constant part 0. -
integrate
Integrates this polynomial with the given constant part. -
negate
Description copied from class:PolynomialNegates this polynomial.- Specified by:
negatein classPolynomial<Double>
-
add
Description copied from class:PolynomialAdds two polynomials together.- Specified by:
addin classPolynomial<Double>
-
multiply
Description copied from class:PolynomialMultiplies two polynomials.- Specified by:
multiplyin classPolynomial<Double>
-
hashCode
public int hashCode() -
equals
-