multivariate_calculus
TypeScript icon, indicating that this package has built-in type declarations

1.4.2 • Public • Published

multivariate_calculus

CircleCI codecov

npm GitHub release (latest by date)

Typescript License

A zero dependency library that handles calculus of several variables in multidimensional space. It works with both TypeScript and JavaScript projects seamlessly. This library is so designed that you can write your mathematics code as you would do maths in pen and paper.

From version 1.0.0, the library is based completely on BigNum objects.

Installation

Browser

If you wish to work with this library in the browser, you can download it from here.

Once you have downloaded the file in you project folder, open up your index.html file and add the following line:

<script src="mcalc.js"></script>

To create a new constant scalar object you can say

const a = Scalar.constant(5);
print(a);

If you open up the developer console window in the browser you will be able to see what the object a looks like.


Node

JavaScript

For using this package in a nodejs environment, you first need to have Nodejs installed on your computer. Once that is done, open up your project directory and create an index.js file. At the top of the file copy the following line:

const mc = require("multivariate_calculus");

This will import all the modules, classes, functions and constants from the package under the name mc. If we try to recreate the same example from above, you would have to write

const a = mc.Scalar.constant(5);
mc.print(a);

You may also avoid having to write mc over and over again by modifying the import statement slightly

const { Scalar } = require("multivariate_calculus");

This way you need not use the namespace object to access the modules, classes, functions and constants. The code will look exactly like in the case of browser use.

TypeScript

Working in TypeScript is similar to working with plain JavaScript. However, before you can start writing your code using TypeScript you need to first make sure that it is installed. If you are unfamiliar with TypeScript check out their documentation here.

Once that is done you can now import stuff from this package by using just one line at the top of your .ts file. To recreate the above example in TypeScript:

import { Scalar, print } from "multivariate_calculus";
 
const a = Scalar.constant(5);
print(a);

The library now comes with cleaner global math functions which you can call with any object. You can even perform trigonometry on Scalar objects by calling the global functions

const x = Scalar.variable("x");
const y = sin(x);
print(y.at(new Map([
    [x, pi]
])));

Check out the documentation for further readings. If there are any issues or some changes you would like to see, file an issue. To check out the documentation of some previous version add the generic version number after the URL: https://terrible-coder.github.io/multivariate_calculus/0.2/.

You can now take a sneak peek into the upcoming features in the next release and their documentation by going to https://terrible-coder.github.io/multivariate_calculus/next/.

Package Sidebar

Install

npm i multivariate_calculus

Weekly Downloads

2

Version

1.4.2

License

MIT

Unpacked Size

369 kB

Total Files

44

Last publish

Collaborators

  • terrible-coder