Third-Party Libraries
In addition to the built in OLI functions, dynamic question expressions have a hand-curated set of open source npm packages available that provide other useful functions for generating dynamic content. These packages may be used for statistical analysis, solving algebraic equations, number formatting, etc.
These functions can be accessed by using the module name within scripts.
Available Third-Party Libraries:
Module Name | Details | Version | Documentation |
---|---|---|---|
PD | Probability Distributions | 0.9.1 | http://statisticsblog.com/probability-distributions |
ss | Simple Statistics | 6.1.0 | https://simplestatistics.org/docs |
jStat | jStat provides native javascript implementations of statistical functions | 1.7.1 | https://jstat.github.io/all.html |
math | Extensive math library | 5.1.0 | http://mathjs.org |
algebra | Build, display, and solve algebraic equations | 0.2.6 | http://algebra.js.org |
numeral | Formatting and manipulating numbers | 2.0.6 | http://numeraljs.com |
_ | Lodash is a modern JavaScript utility library | 4.17.10 | https://lodash.com/docs/4.17.10 |
For example:
// Probability distributions
PD.rbinom(7, 12, 0.2);
// Simple statistics
ss.min([1, 5, -10, 100, 2]);
// jStat
jStat(jStat.rand(3));
// Mathjs
math.derivative('x^2 + x', 'x');
// Algebrajs
new algebra.Expression("x");
// Numeraljs
numeral('1,000').value();
// Lodash
_.union([2], [1, 2]);
If there is a specific third-party package that is needed and is not listed here, please submit a help ticket and request it to be added.