Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mathjs

Package Overview
Dependencies
Maintainers
1
Versions
282
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mathjs

Math.js is an extensive math library for JavaScript and Node.js. It features real and complex numbers, units, matrices, a large set of mathematical functions, and a flexible expression parser.

  • 0.14.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
increased by16.26%
Maintainers
1
Weekly downloads
 
Created

What is mathjs?

mathjs is an extensive math library for JavaScript and Node.js. It features a flexible expression parser, a large set of built-in functions, and supports different data types such as numbers, big numbers, complex numbers, fractions, units, and matrices.

What are mathjs's main functionalities?

Basic Arithmetic

Perform basic arithmetic operations like addition, subtraction, multiplication, and division.

const math = require('mathjs');
const sum = math.add(2, 3); // 5
const product = math.multiply(4, 5); // 20

Matrix Operations

Perform operations on matrices such as addition, multiplication, and inversion.

const math = require('mathjs');
const matrix1 = math.matrix([[1, 2], [3, 4]]);
const matrix2 = math.matrix([[5, 6], [7, 8]]);
const result = math.add(matrix1, matrix2); // [[6, 8], [10, 12]]

Complex Numbers

Handle complex numbers and perform arithmetic operations on them.

const math = require('mathjs');
const complex1 = math.complex(2, 3);
const complex2 = math.complex(1, 4);
const sum = math.add(complex1, complex2); // 3 + 7i

Unit Conversions

Convert between different units of measurement.

const math = require('mathjs');
const distance = math.unit(5, 'km');
const convertedDistance = distance.to('mile'); // 3.10685596 mile

Expression Parsing

Parse and evaluate mathematical expressions from strings.

const math = require('mathjs');
const expr = '2 * (3 + 4)';
const result = math.evaluate(expr); // 14

Other packages similar to mathjs

Keywords

FAQs

Package last updated on 08 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc