factor(x^4-1)
diff(sin(x^2),x)
solve(x^2-4,x)
Useful for calculators, forms, lessons, and anywhere users enter mathematical expressions.
Nerdamer is a lightweight Computer Algebra System for the JavaScript and TypeScript ecosystem.
Use it to simplify expressions, solve equations, work with calculus and linear algebra, or build your own math tools. Nerdamer includes a math parser, a JavaScript and TypeScript API, and a simple scripting language.
npm install nerdamer
Nerdamer works with mathematical expressions symbolically. That means values such as
x, fractions, roots, constants, and complex numbers can
stay in mathematical form instead of being turned into decimal numbers right away.
You can use Nerdamer in the browser, in Node.js, or in a TypeScript project. It runs on the client, so a web page can do symbolic calculations without sending each expression to a server.
Current releases no longer use the 1.x core-plus-add-ons loading model. The complete package can be used directly, and application code can import documented public APIs from the package entry points. It is open source under the Apache-2.0 license.
Nerdamer covers the common building blocks of a computer algebra system while keeping the library approachable for small applications and classroom tools.
Symbolic algebra Simplify, expand, factor, substitute, work with rational expressions, and manipulate polynomials.
Equation solving Solve many equations and systems of equations symbolically or numerically.
Calculus Differentiate, integrate, evaluate limits, and work with sums, products, and transforms.
Matrices and vectors Create matrices and vectors and perform common linear algebra operations.
Complex numbers Work with real and imaginary parts, arguments, rectangular form, and polar form.
Exact arithmetic Keep fractions, radicals, constants, and symbolic values exact when possible.
Arbitrary-precision decimals Choose the precision you need when a decimal answer is more useful.
Sets and assumptions Work with sets and add information about variables when a calculation needs it.
Math parser Enter familiar mathematical expressions and call built-in or user-defined functions.
Built-in scripting language Define variables and functions and use local values, conditions, and loops.
JavaScript and TypeScript API Use Nerdamer from application code with typed public entry points.
Display and reuse results Convert expressions to text or TeX, evaluate them, or compile supported expressions to JavaScript functions.
You do not have to learn every part of Nerdamer before using it. Start with the style that fits what you are building.
factor(x^4-1)
diff(sin(x^2),x)
solve(x^2-4,x)
Useful for calculators, forms, lessons, and anywhere users enter mathematical expressions.
import { factor } from 'nerdamer/algebra';
const result = factor('x^4-1');
console.log(result.text());
Import public functions and classes directly when Nerdamer is part of a larger application. See the API examples for larger programs.
square(x):=x^2;
f(x):=square(x)+1;
f(4)
Define reusable calculations and combine them into small programs without leaving Nerdamer notation.
These projects are still online and have used Nerdamer as part of their math features.
Using Nerdamer in your own project? Share it in the comments below or send it through GitHub.
Questions, suggestions, or something you built?
Leave a comment below. The same Disqus discussion from the original Nerdamer homepage is kept here.