1.0.6 • Published 3 years ago

scimaths v1.0.6

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

To get started

Run

npm install scimaths

or

npm i scimaths

Usage

const scimaths = require("scimaths");

//for arithmetic functions use the scimaths Library like
const { scm } = require("scimaths");

//or
import { scm } from "scimaths";

//Same process for using experimental Features like Tuples
//Noting that the tuple build is still in process, it is pure inspiration from the python concept
import { Tuple } from "scimaths";
const tuple = new Tuple(1, 3, 4, [5, 6]);

What's new?

Better documentation

To solve quadratic equations

In a equation ax^2 + bx + c

Example: x^2 + 2x +1

use "quad(First constant, Second constant, Third constant)"

const { scm } = require("scimaths");

const result = scm.quad(1, 2, 1);
//result = [-1, -1];

both are the values of x

To solve Factorial

use "fact(number)"

Example:

const { scm } = require("scimaths");

const result = scm.fact(5);
//result = 120

Arithmetic mean

use "mean(Array of numbers)"

Example:

const { scm } = require("scimaths");

const data = [1, 2, 3, 4, 5];
const result = scm.mean(data);

Arithmetic median

use "median(Array of numbers)"

Example:

const { scm } = require("scimaths");

const data = [1, 2, 3, 4, 5];
const result = scm.median(data);

Arithmetic mode

use "mode(Array of numbers)"

It returns an object with two properties:

*modes: A set of modes

*frequency: the mode frequency

Example:

const { scm } = require("scimaths");

const data = [1, 2, 5, 3, 4, 5];
const result = scm.mode(data);
//result = {mode:Set(1){5}, frequency: 2}

Range of numbers

use "range(Array of numbers)"

Example:

const { scm } = require("scimaths");

const data = [1, 2, 3, 4, 5];
const result = scm.range(data);
//result = 4

Sum of numbers

use

const { scm } = require("scimaths");

const result = scm.sum([1, 2, 3, 4]);

Inverse of a number

use

const { scm } = require("scimaths");

const result = scm.inv(5);

Exponential of a number

Takes two arguments, First number and Raise number result = firstNumber * 10^raiseNumber

use

const { scm } = require("scimaths");

const result = scm.exp(1, 2);

Tuple Class (experimental)

The tuple class is an inspiration from the python concept, it is an incomplete module but already has some features at this time

Initializing a Tuple

It returns a key/value pair of a tuple object

import { Topple } from "scimaths";

const tuple = new Topple(1, 2, 3, 4);
//topple = {Topple:[1,2,3,4]}

get values of a tuple

import { Topple } from "scimaths";

const tuple = new Topple(1, 2, 3, 4);
const result = tuple.get();
//result = {Topple:[1,2,3,4]}

arrange a tuple

import { Tuple } from "scimaths";

const tuple = new Tuple(1, 4, 3, 2);
const result = tuple.arrange();
//result = {Tuple:[1,2,3,4]}
1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago