UNPKG

nerdamer-ts

Version:

javascript light-weight symbolic math expression evaluator

61 lines (60 loc) 1.74 kB
/** * TODO: Pick a more descriptive name and better description * Breaks a function down into it's parts wrt to a variable, mainly coefficients * Example a*x^2+b wrt x * @param {Symbol} fn * @param {String} wrt * @param {boolean} as_obj */ export function decompose_fn(fn: Symbol, wrt: string, as_obj: boolean): any[] | { a: any; x: Symbol; ax: Symbol | globalThis.Symbol; b: any; }; /** * Returns the coefficients of a symbol given a variable. Given ax^2+b^x+c, it divides * each nth term by x^n. * @param {Symbol} symbol * @param {Symbol} wrt */ export function getCoeffs(symbol: Symbol, wrt: Symbol, info: any): Symbol[]; /** * Checks to see if a number or Symbol is a fraction * @param {Number|Symbol} num * @returns {boolean} */ export function isFraction(num: number | Symbol): boolean; /** * @param {Number|Symbol} obj * @returns {boolean} */ export function isNegative(obj: number | Symbol): boolean; /** * Checks to see if a symbol is in group N * @param {Symbol} symbol */ export function isNumericSymbol(symbol: Symbol): boolean; /** * Gets nth roots of a number * @param {Symbol} symbol * @returns {Vector} */ export function nroots(symbol: Symbol): Vector; /** * Convert number from scientific format to decimal format * @param value */ export function scientificToDecimal(value: any): any; /** * Separates out the variables into terms of variabls. * e.g. x+y+x*y+sqrt(2)+pi returns * {x: x, y: y, x y: x*y, constants: sqrt(2)+pi * @param {type} symbol * @param {type} o * @returns {undefined} * @throws {Error} for expontentials */ export function separate(symbol: any, o: any): undefined; import { Symbol } from "../Types/Symbol"; import { Vector } from "../Types/Vector";