-
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
f
be a polynomial function. Evaluate returns the number given byf(x)
Parameters
x
The 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) -> Bool
Parameters
lhs
Left hand side
rhs
Right 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) -> Polynomial
Parameters
lhs
Left hand side
rhs
Right hand side
-
Substract polynomials to each other non-destructively.
Declaration
Swift
public static func - (lhs: Polynomial, rhs: Polynomial) -> Polynomial
Parameters
lhs
Left hand side
rhs
Right 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_coefs
coefficient of the (x-)term
x_const
constant term
-
Multiplies through this polynomial by the given constant
Declaration
Swift
public static func * (lhs: Polynomial, rhs: BigDouble) -> Polynomial
Parameters
lhs
Left hand side
rhs
Right 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 }