JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13
  • Score
    100M100P100Q60249F
  • License MIT

Provide math operators for the Compute-engine package

Package Exports

  • @compute.ts/math

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@compute.ts/math) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ComputeTS: Math library

Presentation

The engine is based on incremental computation algorithms. When a calculation is submitted to the engine, all the computed values are memorized. So, if you change some variable and query an evaluation, the engine is able to compute the result very fast because it recomputes only what has changed.

Libraries

The API provides several libraries that each comes with dozens of operators.

Imports

Typescript

import {/* required operators */} from '@compute.ts/math';

Javascript

const {/* required operators */} = require('@compute.ts/math');

Operators

pow

pow(xnumber, ynumber) ➜ znumber

The pow operator allows you to create a number expression which evals to x power y

const {number} = new ComputeNumberLibrary();  
const {pow} = new ComputeMathLibrary();

const x = number();  
const y = number();  
const z = pow(x, y);

const value = z.eval();

pi

pi ➜ xnumber

The pi operator allows you to create a number expression which evals to pi (≈1,141593)

const {pi} = new ComputeMathLibrary();

const x = pi;

x.affect(2);

e

e ➜ xnumber

The e operator allows you to create a number expression which evals to e (≈2,71828)

const {e} = new ComputeMathLibrary();

const x = e;  

x.affect(2);

sqrt

sqrt(xnumber) ➜ ynumber

The sqrt operator allows you to create a number expression which evals to the square root of the given expression

const {number} = new ComputeNumberLibrary();  
const {sqrt} = new ComputeMathLibrary();

const x = number();  
const y = sqrt(x);

const value = y.eval();

x2

x2(xnumber) ➜ ynumber

The x2 operator allows you to create a number expression which evals to the square of x

const {number} = new ComputeNumberLibrary();  
const {x2} = new ComputeMathLibrary();

const x = number();  
const y = x2(x);

const value = y.eval();

x3

x3(xnumber) ➜ ynumber

The x3 operator allows you to create a number expression which evals to the cube of x

const {number} = new ComputeNumberLibrary();  
const {x3} = new ComputeMathLibrary();

const x = number();  
const y = x3(x);

const value = y.eval();

log2

log2(xnumber) ➜ ynumber

The log2 operator allows you to create a number expression which evals to the logarithm neperien of the given expression

const {number} = new ComputeNumberLibrary();  
const {log2} = new ComputeMathLibrary();

const x = number();  
const y = log2(x);

const value = y.eval();

log10

log10(xnumber) ➜ ynumber

The log10 operator allows you to create a number expression which evals to the logarithm decimal of the given expression

const {number} = new ComputeNumberLibrary();  
const {log10} = new ComputeMathLibrary();

const x = number();  
const y = log10(x);

const value = y.eval();

exp

exp(xnumber) ➜ ynumber

The exp operator allows you to create a number expression which evals to the exponential of the given expression

const {number} = new ComputeNumberLibrary();  
const {exp} = new ComputeMathLibrary();

const x = number();  
const y = exp(x);

const value = y.eval();

cos

cos(xnumber) ➜ ynumber

The cos operator allows you to create a number expression which evals to the cosinus of the given expression

const {number} = new ComputeNumberLibrary();  
const {cos} = new ComputeMathLibrary();

const x = number();  
const y = cos(x);

const value = y.eval();

sin

sin(xnumber) ➜ ynumber

The sin operator allows you to create a number expression which evals to the sinus of x

const {number} = new ComputeNumberLibrary();  
const {sin} = new ComputeMathLibrary();

const x = number();  
const y = sin(x);

const value = y.eval();

tan

tan(xnumber) ➜ ynumber

The tan operator allows you to create a number expression which evals to the tangente of x

const {number} = new ComputeNumberLibrary();  
const {tan} = new ComputeMathLibrary();

const x = number();  
const y = tan(x);

const value = y.eval();

cosH

cosH(xnumber) ➜ ynumber

The cosH operator allows you to create a number expression which evals to the hyperbolic cosinus of the given expression

const {number} = new ComputeNumberLibrary();  
const {cosH} = new ComputeMathLibrary();

const x = number();  
const y = cosH(x);

const value = y.eval();

sinH

sinH(xnumber) ➜ ynumber

The sinH operator allows you to create a number expression which evals to the hyperbolic sinus of x

const {number} = new ComputeNumberLibrary();  
const {sinH} = new ComputeMathLibrary();

const x = number();  
const y = sinH(x);

const value = y.eval();

tanH

tanH(xnumber) ➜ ynumber

The tanH operator allows you to create a number expression which evals to the hyperbolic tangente of x

const {number} = new ComputeNumberLibrary();  
const {tanH} = new ComputeMathLibrary();

const x = number();  
const y = tanH(x);

const value = y.eval();

arcCos

arcCos(xnumber) ➜ ynumber

The arcCos operator allows you to create a number expression which evals to the arc cosinus of the given expression

const {number} = new ComputeNumberLibrary();  
const {arcCos} = new ComputeMathLibrary();

const x = number();  
const y = arcCos(x);

const value = y.eval();

arcSin

arcSin(xnumber) ➜ ynumber

The arcSin operator allows you to create a number expression which evals to the arc sinus of the given expression

const {number} = new ComputeNumberLibrary();  
const {arcSin} = new ComputeMathLibrary();

const x = number();  
const y = arcSin(x);

const value = y.eval();

arcTan

arcTan(xnumber) ➜ ynumber

The arcTan operator allows you to create a number expression which evals to the arc tangente of the given expression

const {number} = new ComputeNumberLibrary();  
const {arcTan} = new ComputeMathLibrary();

const x = number();  
const y = arcTan(x);

const value = y.eval();

arcCosH

arcCosH(xnumber) ➜ ynumber

The arcCosH operator allows you to create a number expression which evals to the hyperbolic arc cosinus of the given expression

const {number} = new ComputeNumberLibrary();  
const {arcCosH} = new ComputeMathLibrary();

const x = number();  
const y = arcCosH(x);

const value = y.eval();

arcSinH

arcSinH(xnumber) ➜ ynumber

The arcSinH operator allows you to create a number expression which evals to the hyperbolic arc sinus of the given expression

const {number} = new ComputeNumberLibrary();  
const {arcSinH} = new ComputeMathLibrary();

const x = number();  
const y = arcSinH(x);

const value = y.eval();

arcTanH

arcTanH(xnumber) ➜ ynumber

The arcTanH operator allows you to create a number expression which evals to the hyperbolic arc tangente of the given expression

const {number} = new ComputeNumberLibrary();  
const {arcTanH} = new ComputeMathLibrary();

const x = number();  
const y = arcTanH(x);

const value = y.eval();

trunc

trunc(xnumber) ➜ ynumber

The trunc operator allows you to create a number expression which evals to the truncature of x

const {number} = new ComputeNumberLibrary();  
const {trunc} = new ComputeMathLibrary();

const x = number();  
const y = trunc(x);

const value = y.eval();

sign

sign(xnumber) ➜ ynumber

The sign operator allows you to create a number expression which evals to 1 if x is positive, -1 if x is negative

const {number} = new ComputeNumberLibrary();  
const {sign} = new ComputeMathLibrary();

const x = number();  
const y = sign(x);

const value = y.eval();

inverse

inverse(xnumber) ➜ ynumber

The inverse operator allows you to create a number expression which evals to the inverse of the given expression

const {number} = new ComputeNumberLibrary();  
const {inverse} = new ComputeMathLibrary();

const x = number();  
const y = inverse(x);

const value = y.eval();

floor

floor(xnumber) ➜ ynumber

The floor operator allows you to create a number expression which evals to the floor of the given expression

const {number} = new ComputeNumberLibrary();  
const {floor} = new ComputeMathLibrary();

const x = number();  
const y = floor(x);

const value = y.eval();

ceil

ceil(xnumber) ➜ ynumber

The ceil operator allows you to create a number expression which evals to the ceil of the given expression

const {number} = new ComputeNumberLibrary();  
const {ceil} = new ComputeMathLibrary();

const x = number();  
const y = ceil(x);

const value = y.eval();

min

min(x0number, x1number, ..., xnnumber) ➜ ynumber

The min operator allows you to create a number expression which evals to the lowest given expressions

const {number} = new ComputeNumberLibrary();  
const {min} = new ComputeMathLibrary();

const x0 = number();  
const x1 = number();  
// ...  
const xn = number();  
const y = min(x0, x1, ..., xn) `|` x0.min(x1, ..., xn);

const value = y.eval();

max

max(x0number, x1number, ..., xnnumber) ➜ ynumber

The max operator allows you to create a number expression which evals to the highest given expressions

const {number} = new ComputeNumberLibrary();  
const {max} = new ComputeMathLibrary();

const x0 = number();  
const x1 = number();  
// ...  
const xn = number();  
const y = max(x0, x1, ..., xn) `|` x0.max(x1, ..., xn);

const value = y.eval();

mean

mean(x0number, x1number, ..., xnnumber) ➜ ynumber

The mean operator allows you to create a number expression which evals to the mean value of the given expressions

const {number} = new ComputeNumberLibrary();  
const {mean} = new ComputeMathLibrary();

const x0 = number();  
const x1 = number();  
// ...  
const xn = number();  
const y = mean(x0, x1, ..., xn) `|` x0.mean(x1, ..., xn);

const value = y.eval();

median

median(x0number, x1number, ..., xnnumber) ➜ ynumber

The median operator allows you to create a number expression which evals to median value of the given expressions

const {number} = new ComputeNumberLibrary();  
const {median} = new ComputeMathLibrary();

const x0 = number();  
const x1 = number();  
// ...  
const xn = number();  
const y = median(x0, x1, ..., xn) `|` x0.median(x1, ..., xn);  

const value = y.eval();

gcd

gcd(xnumber, ynumber) ➜ znumber

The gcd operator allows you to create a number expression which evals to the greatest common divisor of the given expressions

const {number} = new ComputeNumberLibrary();  
const {gcd} = new ComputeMathLibrary();

const x = number();  
const y = number();  
const z = gcd(x, y);

const value = z.eval();