Skip to content

Latest commit

 

History

History
165 lines (105 loc) · 6.69 KB

LinearEquation.md

File metadata and controls

165 lines (105 loc) · 6.69 KB

LinearEquation

Contains the LinearEquation class, which encodes linear equations of any number of variables.

Author: Novak / cszach@proton.me


LinearEquation~LinearEquation

Encodes linear equations by storing coefficients in an array and the constant term. Coefficients are stored left-to-right.

Kind: inner class of LinearEquation


new LinearEquation(coefficients, constant)

Constructs a LinearEquation instance, which encodes a linear equation.

Param Type Description
coefficients Array.<number> The coefficients of the linear equation.
constant number The constant term of the linear equation.

linearEquation.coefficients : Array.<number>

Array of this equation's coefficients.

Kind: instance property of LinearEquation


linearEquation.constant : number

The constant term of this linear equation.

Kind: instance property of LinearEquation


linearEquation.numberOfVariables : number

The number of variables in this linear equation.

Kind: instance property of LinearEquation


linearEquation.clone() ⇒ LinearEquation

Returns an instance of LinearEquation that is exactly the same as this instance.

Kind: instance method of LinearEquation
Returns: LinearEquation - An exact copy of this instance


linearEquation.multiplyScalar(k) ⇒ LinearEquation

Multiplies this linear equation with a scalar.

Kind: instance method of LinearEquation
Returns: LinearEquation - This linear equation

Param Type Description
k number The scalar to multiply this equation by.

linearEquation.negate() ⇒ LinearEquation

Negates this equation.

Kind: instance method of LinearEquation
Returns: LinearEquation - This linear equation


linearEquation.add(equation) ⇒ LinearEquation

Adds a linear equation to this linear equation.

Kind: instance method of LinearEquation
Returns: LinearEquation - This linear equation

Param Type Description
equation LinearEquation The equation to add to this equation. Both equations must have the same number of coefficients.

linearEquation.subtract(equation) ⇒ LinearEquation

Subtracts a linear equation from this linear equation.

Kind: instance method of LinearEquation
Returns: LinearEquation - This linear equation

Param Type Description
equation LinearEquation The equation to subtract this equation to. Both equations must have the same number of coefficients.

linearEquation.toArray() ⇒ Array.<number>

Returns an array containing the coefficients from left to right and the constant. Helpful in converting to a row or column vector.

Kind: instance method of LinearEquation
Returns: Array.<number> - The array representation of this linear equation