Namespace JXG.Math
↳ JXG.Math
Defined in: math.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Math namespace.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
JXG.Math.eps
eps defines the closeness to zero.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
JXG.Math.binomial(n, k)
Computes the binomial coefficient n over k.
|
<static> |
JXG.Math.cosh(x)
Calculates the cosine hyperbolicus of x.
|
<static> |
JXG.Math.crossProduct(c1, c2)
Calculates the cross product of two vectors both of length three.
|
<static> |
JXG.Math.factorial(n)
Compute the factorial of a positive integer.
|
<static> |
JXG.Math.frustum(l, r, t, b, n, f)
Generates a 4x4 matrix for 3D to 2D projections.
|
<static> |
JXG.Math.identity(n, m)
Generates an identity matrix.
|
<static> |
JXG.Math.innerProduct(a, b, n)
Inner product of two vectors a and b.
|
<static> |
JXG.Math.inverse(Ain)
Compute the inverse of an nxn matrix with Gauss elimination.
|
<static> |
JXG.Math.matMatMult(mat1, mat2)
Computes the product of the two matrices mat1*mat2.
|
<static> |
JXG.Math.matrix(n, m, init)
Initializes a matrix as an array of rows with the given value.
|
<static> |
JXG.Math.matVecMult(mat, vec)
Multiplies a vector vec to a matrix mat: mat * vec.
|
<static> |
JXG.Math.mod(a, m)
The JavaScript implementation of the % operator returns the symmetric modulo.
|
<private> <static> |
JXG.Math.normalize(stdform)
Normalize the standard form [c, b0, b1, a, k, r, q0, q1].
|
<static> |
JXG.Math.pow(base, exponent)
Compute base to the power of exponent.
|
<static> |
JXG.Math.projection(fov, ratio, n, f)
Generates a 4x4 matrix for 3D to 2D projections.
|
<static> |
JXG.Math.sinh(x)
Sine hyperbolicus of x.
|
<static> |
JXG.Math.squampow(base, exponent)
A square & multiply algorithm to compute base to the power of exponent.
|
<static> |
JXG.Math.toGL(m)
Converts a two dimensional array to a one dimensional Float32Array that can be processed by WebGL.
|
<static> |
JXG.Math.transpose(M)
Transposes a matrix given as a two dimensional array.
|
<static> |
JXG.Math.vector(n, init)
Initializes a vector as an array with the coefficients set to the given value resp.
|
Field Detail
<static>
{number}
JXG.Math.eps
eps defines the closeness to zero. If the absolute value of a given number is smaller
than eps, it is considered to be equal to zero.
Method Detail
<static>
{Number}
JXG.Math.binomial(n, k)
Computes the binomial coefficient n over k.
- Parameters:
- {Number} n
- Fraction will be ignored
- {Number} k
- Fraction will be ignored
- Returns:
- {Number} The binomial coefficient n over k
<static>
{Number}
JXG.Math.cosh(x)
Calculates the cosine hyperbolicus of x.
- Parameters:
- {Number} x
- The number the cosine hyperbolicus will be calculated of.
- Returns:
- {Number} Cosine hyperbolicus of the given value.
<static>
{Array}
JXG.Math.crossProduct(c1, c2)
Calculates the cross product of two vectors both of length three.
In case of homogeneous coordinates this is either
- the intersection of two lines
- the line through two points
- Parameters:
- {Array} c1
- Homogeneous coordinates of line or point 1
- {Array} c2
- Homogeneous coordinates of line or point 2
- Returns:
- {Array} vector of length 3: homogeneous coordinates of the resulting point / line.
<static>
{Number}
JXG.Math.factorial(n)
Compute the factorial of a positive integer. If a non-integer value
is given, the fraction will be ignored.
- Parameters:
- {Number} n
- Returns:
- {Number} n! = n*(n-1)*...*2*1
<static>
{Array}
JXG.Math.frustum(l, r, t, b, n, f)
Generates a 4x4 matrix for 3D to 2D projections.
- Parameters:
- {Number} l
- Left
- {Number} r
- Right
- {Number} t
- Top
- {Number} b
- Bottom
- {Number} n
- Near
- {Number} f
- Far
- Returns:
- {Array} 4x4 Matrix
<static>
{Array}
JXG.Math.identity(n, m)
Generates an identity matrix. If n is a number and m is undefined or not a number, a square matrix is generated,
if n and m are both numbers, an nxm matrix is generated.
- Parameters:
- {Number} n
- Number of rows
- {Number} m Optional, Default: n
- Number of columns
- Returns:
- {Array} A square matrix of length n with all coefficients equal to 0 except a_(i,i), i out of (1, ..., n), if m is undefined or not a number or a n times m-matrix with a_(i,j) = 0 and a_(i,i) = 1 if m is a number.
<static>
{Number}
JXG.Math.innerProduct(a, b, n)
Inner product of two vectors a and b. n is the length of the vectors.
- Parameters:
- {Array} a
- Vector
- {Array} b
- Vector
- {Number} n Optional
- Length of the Vectors. If not given the length of the first vector is taken.
- Returns:
- {Number} The inner product of a and b.
<static>
{Array}
JXG.Math.inverse(Ain)
Compute the inverse of an nxn matrix with Gauss elimination.
- Parameters:
- {Array} Ain
- Returns:
- {Array} Inverse matrix of Ain
<static>
{Array}
JXG.Math.matMatMult(mat1, mat2)
Computes the product of the two matrices mat1*mat2.
- Parameters:
- {Array} mat1
- Two dimensional array of numbers
- {Array} mat2
- Two dimensional array of numbers
- Returns:
- {Array} Two dimensional Array of numbers containing result
<static>
{Array}
JXG.Math.matrix(n, m, init)
Initializes a matrix as an array of rows with the given value.
- Parameters:
- {Number} n
- Number of rows
- {Number} m Optional, Default: n
- Number of columns
- {Number} init Optional, Default: 0
- Initial value for each coefficient
- Returns:
- {Array} A n times m-matrix represented by a two-dimensional array. The inner arrays hold the columns, the outer array holds the rows.
<static>
{Array}
JXG.Math.matVecMult(mat, vec)
Multiplies a vector vec to a matrix mat: mat * vec. The matrix is interpreted by this function as an array of rows. Please note: This
function does not check if the dimensions match.
- Parameters:
- {Array} mat
- Two dimensional array of numbers. The inner arrays describe the columns, the outer ones the matrix' rows.
- {Array} vec
- Array of numbers
- Returns:
- {Array} Array of numbers containing the result
- Examples:
var A = [[2, 1], [1, 3]], b = [4, 5], c; c = JXG.Math.matVecMult(A, b) // c === [13, 19];
<static>
{Number}
JXG.Math.mod(a, m)
The JavaScript implementation of the % operator returns the symmetric modulo.
They are both identical if a >= 0 and m >= 0 but the results differ if a or m < 0.
- Parameters:
- {Number} a
- {Number} m
- Returns:
- {Number} Mathematical modulo a mod m
<private> <static>
{Array}
JXG.Math.normalize(stdform)
Normalize the standard form [c, b0, b1, a, k, r, q0, q1].
- Parameters:
- {Array} stdform
- The standard form to be normalized.
- Returns:
- {Array} The normalized standard form.
<static>
{Number}
JXG.Math.pow(base, exponent)
Compute base to the power of exponent.
- Parameters:
- {Number} base
- {Number} exponent
- Returns:
- {Number} base to the power of exponent.
<static>
{Array}
JXG.Math.projection(fov, ratio, n, f)
Generates a 4x4 matrix for 3D to 2D projections.
- Parameters:
- {Number} fov
- Field of view in vertical direction, given in rad.
- {Number} ratio
- Aspect ratio of the projection plane.
- {Number} n
- Near
- {Number} f
- Far
- Returns:
- {Array} 4x4 Projection Matrix
<static>
{Number}
JXG.Math.sinh(x)
Sine hyperbolicus of x.
- Parameters:
- {Number} x
- The number the sine hyperbolicus will be calculated of.
- Returns:
- {Number} Sine hyperbolicus of the given value.
<static>
{Number}
JXG.Math.squampow(base, exponent)
A square & multiply algorithm to compute base to the power of exponent.
Implementated by Wolfgang Riedl.
- Parameters:
- {Number} base
- {Number} exponent
- Returns:
- {Number} Base to the power of exponent
<static>
{Float32Array}
JXG.Math.toGL(m)
Converts a two dimensional array to a one dimensional Float32Array that can be processed by WebGL.
- Parameters:
- {Array} m
- A matrix in a two dimensional array.
- Returns:
- {Float32Array} A one dimensional array containing the matrix in column wise notation. Provides a fall back to the default JavaScript Array if Float32Array is not available.
<static>
{Array}
JXG.Math.transpose(M)
Transposes a matrix given as a two dimensional array.
- Parameters:
- {Array} M
- The matrix to be transposed
- Returns:
- {Array} The transpose of M
<static>
{Array}
JXG.Math.vector(n, init)
Initializes a vector as an array with the coefficients set to the given value resp. zero.
- Parameters:
- {Number} n
- Length of the vector
- {Number} init Optional, Default: 0
- Initial value for each coefficient
- Returns:
- {Array} A n times m-matrix represented by a two-dimensional array. The inner arrays hold the columns, the outer array holds the rows.