0.0.5 • Published 5 years ago

@amilas/math.api v0.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Presentation

This package is a library for the Amilas project, it permits you to build computation models based on mathematics tools.

Installation

This package is compatible with npm and can be installed like this:

npm install @amilas/math.api

see also:

Usage

Use the following tools to build your model, you can mix them with others libraries. Once your model is built, send it to the amilas-server with @amilas/rest.api

min

import {AmilasContext} from "@amilas/core"
import AmilasMathApi from "@amilas/math.api"
import AmilasNumberApi from "@amilas/number.api"

const context = new AmilasContext();
const {min} = new AmilasMathApi(context);
const {number} = new AmilasMathApi(context);

const nodeA = number(10);
const nodeB = number(20);
const nodeC = number(30);
const minNode = min(nodeA, nodeB, nodeC); // Evals to 10

max

import {AmilasContext} from "@amilas/core"
import AmilasMathApi from "@amilas/math.api"
import AmilasNumberApi from "@amilas/number.api"

const context = new AmilasContext();
const {max} = new AmilasMathApi(context);
const {number} = new AmilasMathApi(context);

const nodeA = number(10);
const nodeB = number(20);
const nodeC = number(30);
const maxNode = min(nodeA, nodeB, nodeC); // Evals to 30

functions

sqrt

import {AmilasContext} from "@amilas/core"
import AmilasMathApi from "@amilas/math.api"
import AmilasNumberApi from "@amilas/number.api"

const context = new AmilasContext();
const {sqrt} = new AmilasMathApi(context);
const {number} = new AmilasMathApi(context);

const node = number(25);

const x1 = sqrt(node); 
const x2 = node.sqrt()

x2

import {AmilasContext} from "@amilas/core"
import AmilasMathApi from "@amilas/math.api"
import AmilasNumberApi from "@amilas/number.api"

const context = new AmilasContext();
const {x2} = new AmilasMathApi(context);
const {number} = new AmilasMathApi(context);

const node = number(5);
const x2Node = x2(node); // Evals to 25

x3

import {AmilasContext} from "@amilas/core"
import AmilasMathApi from "@amilas/math.api"
import AmilasNumberApi from "@amilas/number.api"

const context = new AmilasContext();
const {x3} = new AmilasMathApi(context);
const {number} = new AmilasMathApi(context);

const node = number(5);
const x3Node = x3(node); // Evals to 125

floor

import {AmilasContext} from "@amilas/core"
import AmilasMathApi from "@amilas/math.api"
import AmilasNumberApi from "@amilas/number.api"

const context = new AmilasContext();
const {floor} = new AmilasMathApi(context);
const {number} = new AmilasMathApi(context);

const node = number(10.3);
const floorNode = floor(node); // Evals to 10

ceil

import {AmilasContext} from "@amilas/core"
import AmilasMathApi from "@amilas/math.api"
import AmilasNumberApi from "@amilas/number.api"

const context = new AmilasContext();
const {ceil} = new AmilasMathApi(context);
const {number} = new AmilasMathApi(context);

const node = number(10.3);
const ceilNode = ceil(node); // Evals to 11

exp

import {AmilasContext} from "@amilas/core"
import AmilasMathApi from "@amilas/math.api"
import AmilasNumberApi from "@amilas/number.api"

const context = new AmilasContext();
const {exp} = new AmilasMathApi(context);
const {number} = new AmilasMathApi(context);

const node = number(5);
const expNode = exp(node); // Evals to ~148.4

log2

import {AmilasContext} from "@amilas/core"
import AmilasMathApi from "@amilas/math.api"
import AmilasNumberApi from "@amilas/number.api"

const context = new AmilasContext();
const {log2} = new AmilasMathApi(context);
const {number} = new AmilasMathApi(context);

const node = number(5);
const log2Node = log2(node); // Evals to ~1.609

log10

import {AmilasContext} from "@amilas/core"
import AmilasMathApi from "@amilas/math.api"
import AmilasNumberApi from "@amilas/number.api"

const context = new AmilasContext();
const {log10} = new AmilasMathApi(context);
const {number} = new AmilasMathApi(context);

const node = number(5);
const log10Node = log10(node); // Evals to ~0.698
0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago