0.2.4 • Published 6 months ago

@types/algebra.js v0.2.4

Weekly downloads
244
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/algebra.js

Summary

This package contains type definitions for algebra.js (http://algebra.js.org).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/algebra.js.

index.d.ts

// Type definitions for algebra.js 0.2
// Project: http://algebra.js.org
// Definitions by: Federico Caselli <https://github.com/CaselIT>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2

declare class Term {
    coefficients: algebra.js.Fraction[];
    variables: Variable[];
    coefficient(): algebra.js.Fraction;
    toString(): string;
}

declare class Variable {
    variable: string;
    toString(): string;
}

type Union = string | number | algebra.js.Fraction | Term;

declare namespace algebra.js {
    function parse(input: string): Equation | Expression;
    function toTex(input: Fraction | Expression | Equation | object | Array<Fraction | object>): string;

    class Equation {
        lhs: Expression;
        rhs: Expression;
        constructor(lhs: Expression, rhs: Expression | Fraction | number);
        solveFor(variable: string): Fraction | Fraction[] | number[] | Expression | undefined;
        toString(): string;
    }

    class Expression {
        constants: Fraction[];
        terms: Term[];
        constructor(variable: Union | undefined);
        add(other: Union | Expression, simplify?: boolean): Expression;
        divide(other: Fraction | number, simplify?: boolean): Expression;
        eval(p: object, simplify?: boolean): Expression;
        multiply(other: Union | Expression, simplify?: boolean): Expression;
        pow(p: number, simplify?: boolean): Expression;
        constant(): Fraction;
        simplify(): Expression;
        subtract(other: Union | Expression, simplify?: boolean): Expression;
        summation(variable: string, lower: number, upper: number, simplify?: boolean): Expression;
        toString(): string;
    }

    class Fraction {
        denom: number;
        numer: number;
        constructor(num: number, denom: number);
        abs(): Fraction;
        add(other: Fraction | number, simplify?: boolean): Fraction;
        divide(other: Fraction | number, simplify?: boolean): Fraction;
        multiply(other: Fraction | number, simplify?: boolean): Fraction;
        subtract(other: Fraction | number, simplify?: boolean): Fraction;
        toString(): string;
        valueOf(): number;
    }
}
export = algebra.js;

Additional Details

  • Last updated: Mon, 14 Feb 2022 21:31:25 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Federico Caselli.