Skip to content

leomotors/polynomial-generator

Repository files navigation

Polynomial Generator

Library to generate random polynomial

Can be use to generate problems to solve

📃 Example

import { generate, generateMany } from "polynomial-generator";

const option = {
    numeratorRange: 10,
    denominatorRange: 2,
    degree: 2,
};

// generate single
const [polynomial, roots] = generate(option);

console.log(polynomial.toString());        // 2x²+15x-8
console.log(polynomial.toString("html"));  // 2x<sup>2</sup>+15x-8
console.log(polynomial.toString("latex")); // 2x^{2}+15x-8

// generate many
const polynomials = generateMany(option, 100);

📚 Documents

TypeDoc