Class: polyrat

polyrat

Rational Polynumber (of arbitrary dimension)

Constructor

new polyrat()

Source:
Requires:
  • module:rat

Requires

  • module:rat

Members

(static, readonly) CIRCLE :polyrat

z = -1 + x² + y²
Type:
Properties:
Name Type Description
CIRCLE
Source:

(static, readonly) FERMAT :polyrat

z = -1 + x³ + y³
Type:
Properties:
Name Type Description
FERMAT
Source:

(static, readonly) FOLIUM :polyrat

z = x³ - 3xy + y³
Type:
Properties:
Name Type Description
FOLIUM
Source:

(static, readonly) HIPPOPEDE :polyrat

A hippopede
Type:
Properties:
Name Type Description
HIPPOPEDE
Source:

(static, readonly) HYPERBOLA :polyrat

z = -1 + xy
Type:
Properties:
Name Type Description
HYPERBOLA
Source:

(static, readonly) IDENTITY :polyrat

One, the multiplicative identity
Type:
Properties:
Name Type Description
IDENTITY
Source:

(static, readonly) JUMPINGJACK :polyrat

Jumping Jack polynomial
Type:
Properties:
Name Type Description
JUMPINGJACK
Source:

(static, readonly) LEMNISCATE :polyrat

Type:
Source:

(static, readonly) LEMNISCATE_BERNOULLI :polyrat

z = -2x² + 2y² + 2x²y² + x^4 + y^4
Type:
Properties:
Name Type Description
LEMNISCATE_BERNOULLI
Source:

(static, readonly) LEMNISCATE_GERONO :polyrat

z = -2x² + 2y² + 2x²y² + x^4 + y^4
Type:
Properties:
Name Type Description
LEMNISCATE_GERONO
Source:

(static, readonly) LINEAR :polyrat

z = x - y
Type:
Properties:
Name Type Description
LINEAR
Source:

(static, readonly) NIRCLE :polyrat

z = 1 + x² + y²
Type:
Properties:
Name Type Description
NIRCLE
Source:

(static) ONE

Alias for polyrat.IDENTITY
Source:

(static, readonly) PARABOLA :polyrat

z = x² - y
Type:
Properties:
Name Type Description
PARABOLA
Source:

(static, readonly) PARABOLA_INVERSE :polyrat

z = 1/x² - y
Type:
Properties:
Name Type Description
PARABOLA_INVERSE
Source:

(static, readonly) PHI :polyrat

z = -xy - x² - y²
Type:
Properties:
Name Type Description
PHI
Source:

(static, readonly) QUARTIC :polyrat

A quartic polynomial
Type:
Properties:
Name Type Description
QUARTIC
Source:

(static, readonly) ZERO :polyrat

Zero, the additive identity
Type:
Properties:
Name Type Description
ZERO
Source:

Methods

(static) _countDimensions(an, c) → {Integer}

Count the number of dimensions of an array recursively
Parameters:
Name Type Description
an polyrat array to count the dimensions of
c polyrat (counter used during recursion)
Source:
Returns:
number of dimensions
Type
Integer

(static) add(out, a, b) → {polyrat}

Adds two polyrats
Parameters:
Name Type Description
out polyrat the receiving number
a polyrat the first operand
b polyrat the second operand
Source:
Returns:
out
Type
polyrat

(static) binary_operation(out, a, b, operation) → {polyrat}

Performs a function on each element of the two polyrats, outputting the results to a new polyrat
Parameters:
Name Type Description
out polyrat the receiving number
a polyrat the first operand
b polyrat the second operand
operation function to perform
Source:
Returns:
out
Type
polyrat

(static) countDimensions(a) → {Integer}

Count the number of dimensions of an array
Parameters:
Name Type Description
a polyrat number to count the dimensions of
Source:
Returns:
number of dimensions
Type
Integer

(static) create() → {polyrat}

Creates a new, empty polyrat
Source:
Returns:
a new polynumber
Type
polyrat

(static) derivatives(a) → {Array}

Calculates the derivates of a polynumber
Parameters:
Name Type Description
a polyrat polynumber to take the derivatives of
Source:
Returns:
array of polyrats, corresponding to the sub-derivatives of the input
Type
Array

(static) div()

Alias for polyrat.divide
Source:

(static) divide(out, a, b) → {polyrat}

Divides two polyrats
Parameters:
Name Type Description
out polyrat the receiving number
a polyrat the first operand
b polyrat the second operand
Source:
Returns:
out
Type
polyrat

(static) equals(a, b) → {Bool}

Returns true when the first polyrat is equal to the second
Parameters:
Name Type Description
a polyrat the first operand
b polyrat the second operand
Source:
Returns:
true when the two polyrats are equal
Type
Bool

(static) evaluate(out, a, array) → {bigrat}

Evaluate a polynomial for a certain variable(s)
Parameters:
Name Type Description
out bigrat the receiving number
a polyrat the polynumber to evaluate
array Array of values (of type "bigrat") to plug in to the polynomial
Source:
Returns:
resulting big rational number
Type
bigrat

(static) forEachNonZeroElement(a, callback)

Calls a function for each non-zero element in the polynumber
Parameters:
Name Type Description
a polyrat rational polynumber
callback function function
Source:

(static) fromJSON(JSON) → {polyrat}

Creates a polynumber from it's JSON representation
Parameters:
Name Type Description
JSON String representation of the number
Source:
Returns:
a rational polynumber
Type
polyrat

(static) fromValues(array) → {polyrat}

Creates a new polynumber initialized with the given array of either integers or rats
Parameters:
Name Type Description
array Array of values (of type "rat" --- not yet)
Source:
Returns:
a new polynumber
Type
polyrat

(static) getGLSLFormula(a) → {String}

Evaluate a polynomial for a certain variable(s), modified to work in GLSL (to run on GPU)
Parameters:
Name Type Description
a polyrat polynumber
Source:
Returns:
GLSL formula to evaluate the polynomial
Type
String

(static) getJSFormula(a) → {String}

Evaluate a polynomial for a certain variable(s)
Parameters:
Name Type Description
a polyrat polynumber
Source:
Returns:
javascript formula to evaluate the polynomial
Type
String

(static) mergeDimension(out, a, array) → {polyrat}

Add another variable/dimension to a polynumber
Parameters:
Name Type Description
out polyrat the receiving number
a rat the first operand
array Array of values (of type "rat")
Source:
Returns:
a new polynumber
Type
polyrat

(static) mul()

Alias for polyrat.multiply
Source:

(static) multiply(out, a, b) → {polyrat}

Multiplies two polyrats
Parameters:
Name Type Description
out polyrat the receiving number
a polyrat the first operand
b polyrat the second operand
Source:
Returns:
out
Type
polyrat

(static) normalize(out, a) → {polyrat}

Normalize a polynumber
Parameters:
Name Type Description
out polyrat the receiving number
a polyrat number to normalize
Source:
Returns:
out
Type
polyrat

(static) str(a) → {String}

Returns a string representation (polynomial format, in ascending order by degree, then alphabetically) -- not yet!
Parameters:
Name Type Description
a polyrat rational polynumber to represent as a string
Source:
Returns:
string representation of the number
Type
String

(static) sub()

Alias for polyrat.subtract
Source:

(static) subtract(out, a, b) → {polyrat}

Subtracts two polyrats
Parameters:
Name Type Description
out polyrat the receiving number
a polyrat the first operand
b polyrat the second operand
Source:
Returns:
out
Type
polyrat

(static) toJSON(a) → {String}

Returns a string representation (JSON)
Parameters:
Name Type Description
a polyrat rational polynumber to represent as a string
Source:
Returns:
JSON representation of the number
Type
String