OLI Dynamic Questions

OLI Dynamic Questions

  • Docs
  • API
  • Examples
  • Help

›Writing Scripts

Getting Started

  • Overview
  • Requirements

Creating Questions

  • Workflow
  • Referencing Variables

Writing Scripts

  • Script Basics
  • Built-In Functions
  • Third-Party Libraries

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 NameDetailsVersionDocumentation
PDProbability Distributions0.9.1http://statisticsblog.com/probability-distributions
ssSimple Statistics6.1.0https://simplestatistics.org/docs
jStatjStat provides native javascript implementations of statistical functions1.7.1https://jstat.github.io/all.html
mathExtensive math library5.1.0http://mathjs.org
algebraBuild, display, and solve algebraic equations0.2.6http://algebra.js.org
numeralFormatting and manipulating numbers2.0.6http://numeraljs.com
_Lodash is a modern JavaScript utility library4.17.10https://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.

← Built-In Functions
OLI Dynamic Questions
Docs
Getting StartedWriting Scripts
Community
Course Showcase (Coming soon)OLI Slack
More
OLIOLI Course EditorGitHubStar
Copyright © 2025 Carnegie Mellon University