Mathematiqs is a simple yet powerful Maths library for TypeScript, designed to provide essential mathematical functions for both browser and Node.js environments. This library includes a variety of mathematical functions like addition, subtraction, trigonometric functions, logarithms, and more, as well as a command-line interface (CLI) for easy evaluation of expressions.
- A collection of essential mathematical functions:
- Basic operations:
add
,subtract
,multiply
,divide
- Trigonometric functions:
sin
,cos
,tan
,cosec
,sec
,cot
- Other functions:
sqrt
,pow
,log
,log10
,round
,random
,toRad
,toDeg
,fact
- Basic operations:
- CLI support to evaluate mathematical expressions directly from the command line.
- Full TypeScript support with type definitions for seamless development.
- Lightweight and fast with minimal dependencies.
To install the package, you can use npm:
npm install mathematiqs
Or if you prefer using yarn:
yarn add mathematiqs
You can import the desired functions into your TypeScript project as follows:
import { add, subtract, multiply, divide } from 'mathematiqs';
console.log(add(1, 2)); // Output: 3
console.log(multiply(4, 5)); // Output: 20
console.log(sin(Math.PI / 2)); // Output: 1
Once installed, you can use the Maths CLI to evaluate mathematical expressions directly from your terminal.
- Install globally (optional):
npm install -g mathematiqs
- Use the CLI to evaluate an expression:
maths add(1,4) # Output: Result: 5
maths sqrt(16) # Output: Result: 4
- Basic Math:
add(a, b)
,subtract(a, b)
,multiply(a, b)
,divide(a, b)
- Trigonometry:
sin(x)
,cos(x)
,tan(x)
,cosec(x)
,sec(x)
,cot(x)
- Logarithms:
log(x)
,log10(x)
- Other Functions:
sqrt(x)
,pow(x, y)
,round(x)
,random()
,toRad(x)
,toDeg(x)
,fact(x)
We welcome contributions! Please check the CONTRIBUTING.md for guidelines.
This library is maintained by @MFM-347.
The code in this repository is licensed under the MIT License. View more info here. 📜✅🖋️