-
List of coefficients
Declaration
Swift
public var coefs: [BigDouble] { get set } -
Creates a polynomial based on the coefficients
Declaration
Swift
public convenience init(_ coefficients: BigDouble...) throws -
Creates a polynomial based on the coefficients
Declaration
Swift
public init(_ coefficients: [BigDouble]) throws -
Evaluates the current polynomial at the given point
Let
fbe a polynomial function. Evaluate returns the number given byf(x)Parameters
xThe input value for the polynomial function
-
Equal operator
Returns true only if all the coefficient exactly match.
Declaration
Swift
public static func == (lhs: Polynomial, rhs: Polynomial) -> BoolParameters
lhsLeft hand side
rhsRight hand side
-
Produces a string represenation of the polynomial
Declaration
Swift
public override var description: String { get } -
Add polynomials to each other non-destructively.
Declaration
Swift
public static func + (lhs: Polynomial, rhs: Polynomial) -> PolynomialParameters
lhsLeft hand side
rhsRight hand side
-
Substract polynomials to each other non-destructively.
Declaration
Swift
public static func - (lhs: Polynomial, rhs: Polynomial) -> PolynomialParameters
lhsLeft hand side
rhsRight hand side
-
Negates this polynomial.
Does so non-destructively
Declaration
Swift
public var negated: Polynomial { get } -
Computes the derivative of this polynomial
Declaration
Swift
public var derivative: Polynomial { get } -
Divides the polynomial by the leading coefficient so that we would have a monic polynomial
Declaration
Swift
public var normalized: Polynomial { get } -
Returns the Cauchy Polynomial from this polynomial
Declaration
Swift
public var cauchyPoly: Polynomial { get } -
Divides this polynomial by given linear (1 degree) polynomial (Non destructive)
Parameters
x_coefscoefficient of the (x-)term
x_constconstant term
-
Multiplies through this polynomial by the given constant
Declaration
Swift
public static func * (lhs: Polynomial, rhs: BigDouble) -> PolynomialParameters
lhsLeft hand side
rhsRight hand side
-
Finds roots of the polynomial
Not always inclusive. Sometimes, for the same polynomials, results are different as it relies on guesses.
Note to dev team: performance is not ideal and could be improved by relying on native numbers when possible.
Declaration
Swift
public var roots: [BigDouble] { get }
View on GitHub
Polynomial Class Reference