Glen Whitney f6d3e9ea8d
feat: add polynomialRoot function (#2839)
* feat: add polynomialRoot function

  This is intended as a benchmark for general arithmetic/basic algebra
  functionality of mathjs, but was chosen to be something of potential
  independent utility as well, worth adding to mathjs in its own right.

  Currently ol=nly computes the numerical roots for real or complex
  polynomials of degree three or less.

  As usual, adds documentation, embedded documentation, tests, TypeScript
  declaration, and TypeScript tests.

  Also updates doc.test.js to make it easier to specify an array of complex
  numbers as the expected output, and comapres with the appropriate fuzz
  in such cases.

  Finally, adds a benchmark that computes the roots of all cubics with
  nonnegative integer coefficients no larger than five.

* doc: fix typo in polynomialRoot embedded docs

Thanks, SamuelTLG

* style: avoid slightly cryptic Boolean flag stand-in
2022-11-18 15:53:45 +01:00
..
2019-07-20 13:46:31 +02:00
2022-07-19 12:04:35 +02:00

Benchmarks

This directory contains benchmarks which can be used when working on performance improvements of math.js.

How to run

First build the source code once:

$ npm install
$ npm run build

To run all benchmarks:

$ node index.js

To run a single set of benchmarks:

$ node expression_parser.js

Python benchmarks

Install python, and the python library numpy, then run the benchmarks:

$ python matrix_operations_python.py

Octave benchmarks

For matrix operations, there is a small benchmark for Octave. Open Octave, run the script matrix_operations_octave.m

To do

  • use larger matrix, like 250x250 instead of 25x25
  • Compare expression parsers
    • math.js
    • expr-eval
    • jsep
    • math-expression-evaluator