emath

This is a module for math.

Usage no npm install needed!

<script type="module">
  import emath from 'https://cdn.skypack.dev/emath';
</script>

README

EMATH

EMATH is a module for math.

What's the mean of "EMATH"?
Just easy? Maybe.
Energetic? Maybe.
Effectual? Also right.
There are so many means of "EMATH".
All are right.

New property in this version

  • Changed the function expression
    • Added the support for root numbers in function expression()
    • Added the support sin,cos,tan,asin,acos,atan in function expression()
  • Added part: dataStruct
    • Added class: stack
    • Added class: queue
    • Added class: priority_queue
  • Perfect the annotation
  • Added the documentation of emath
  • Added the linear algebra part

Download

Download with npm:

$:npm install emath

Or download with yarn:

$:yarn add emath

Usage

/*
* A <Hello world> of emath.
*/
var emath = require("emath");// require emath
var fractions1 = new emath.number.fractions({
    denominator: 10,
    numerator: 1
});// create a fractions
console.log(fractions1.value());// print the value of fractions1,output: 0.1

You a use function MCF or LCM to get maximum common factor or least common multiple.

var emath = require("emath");
var mcf = emath.number.MCF(20,12);
var lcm = emath.number.LCM(20,12);
console.log("mcf:" + mcf + ",lcm:" + lcm);// output:4,60

And there is a important function of emath:expression(exp).

var emath = require("emath");
var exp = "1\n---\n5";
var value = emath.number.expression(exp);
console.log(value);// output:0.2

You can use sigma by function sigma of function expression.

/*
* The first function to use sigma
*/
var emath = require("emath");
var value = emath.number.sigma("2^i",10,{
    name: "i",
    value: 0
});
console.log(value);
/*
* The second function to use sigma
*/
var emath = require("emath");
var exp = "10\n==\n /\n | 2^i\n \\\n==\ni=0";
var value = emath.number.expression(exp);
console.log(value);

And you also can write some expression in a file.
sigma.math:

10
==
\
 | 2^i
/
==
i=0

Then use function expression.

var emath = require("emath");
var fs = require("fs");
var exp = fs.readFileSync("sigma.math").toString();
var value = emath.number.expression(exp);
console.log(value);

The documentation of emath

click here -> http://yhzheng.com/emath/doc/index.html

The demo

License

MIT