Package Exports
- peo
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (peo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Prime Exponent Object
(PEO, Peo class)
A Prime Exponent Object (Peo) is a JavaScript object which stores small or large rational numbers as an object of the form {2:1000, 3:-567} = 2^1000 * 3^-567, i.e. as an object with keys equal to primes, and values equal to the exponent of that prime.
The class contains:
- A data store of these primes and exponents
- Cached data, e.g. a Fraction (from fraction.js), a textual description
- Functions which operate on the Peo, e.g. getFraction(), getText(), toString()
To use peo package
npm i peoin your JavaScript project directory to install this package inpackage.jsonvar Peo = require("peo")at top of each JavaScript file to access the API
API
Constructors
new Peo(a)foranew Peo(a, b)fora/bnew Peo(new Fraction(a, b))fora/b(Fractionis from thefraction.jspackage)new Peo({p:3,q:-2})forp^3 / q^2wherep,qprimes
Functions
_.getPrimeExps()returns the object of primes and exponents, such as{2:3, 3:-2}_.getPrimeExp(p)returns the exponent of that prime_.getFraction()returns a suitable Fraction object, similar tonew Fraction(8, 9)_.getText()returns a String representation, e.g."8/9"_.toString()returns the same String, overriding the default for Peo