sesaparcours
    Preparing search index...

    Factory and Dependencies


    interface MathJsInstance {
        AccessorNode: AccessorNodeCtor;
        apply: <T extends MathCollection<MathNumericType>>(
            array: T,
            dim: number,
            callback: (array: MathCollection) => number,
        ) => T;
        ArrayNode: ArrayNodeCtor;
        AssignmentNode: AssignmentNodeCtor;
        atomicMass: Unit;
        avogadro: Unit;
        BlockNode: BlockNodeCtor;
        bohrMagneton: Unit;
        bohrRadius: Unit;
        boltzmann: Unit;
        classicalElectronRadius: Unit;
        ConditionalNode: ConditionalNodeCtor;
        conductanceQuantum: Unit;
        config: (options: ConfigOptions) => ConfigOptions;
        ConstantNode: ConstantNodeCtor;
        coulomb: Unit;
        create: (
            factories: FactoryFunctionMap,
            config?: ConfigOptions,
        ) => MathJsInstance;
        deuteronMass: Unit;
        e: number;
        efimovFactor: Unit;
        electricConstant: Unit;
        electronMass: Unit;
        elementaryCharge: Unit;
        expression: MathNode;
        factory: <T, TDeps extends readonly (keyof MathJsInstance)[]>(
            name: string,
            dependencies: TDeps,
            create: (
                injected: Pick<
                    MathJsInstance,
                    Extract<MathJsFunctionName, TDeps[number]>,
                >,
            ) => T,
            meta?: any,
        ) => FactoryFunction<T>;
        faraday: Unit;
        fermiCoupling: Unit;
        fineStructure: Unit;
        firstRadiation: Unit;
        FunctionAssignmentNode: FunctionAssignmentNodeCtor;
        FunctionNode: FunctionNodeCtor;
        gasConstant: Unit;
        gravitationConstant: Unit;
        gravity: Unit;
        hartreeEnergy: Unit;
        i: number;
        IndexNode: IndexNodeCtor;
        Infinity: number;
        inverseConductanceQuantum: Unit;
        isArray: (arg: any) => arg is any[];
        klitzing: Unit;
        LN10: number;
        LN2: number;
        LOG10E: number;
        LOG2E: number;
        loschmidt: Unit;
        magneticConstant: Unit;
        magneticFluxQuantum: Unit;
        Matrix: MatrixCtor;
        molarMass: Unit;
        molarMassC12: Unit;
        molarPlanckConstant: Unit;
        molarVolume: Unit;
        NaN: number;
        neutronMass: Unit;
        Node: NodeCtor;
        nuclearMagneton: Unit;
        ObjectNode: ObjectNodeCtor;
        OperatorNode: OperatorNodeCtor;
        ParenthesisNode: ParenthesisNodeCtor;
        parse: ParseFunction;
        phi: number;
        pi: number;
        planckCharge: Unit;
        planckConstant: Unit;
        planckLength: Unit;
        planckMass: Unit;
        planckTemperature: Unit;
        planckTime: Unit;
        protonMass: Unit;
        quantumOfCirculation: Unit;
        RangeNode: RangeNodeCtor;
        reducedPlanckConstant: Unit;
        RelationalNode: RelationalNodeCtor;
        rydberg: Unit;
        sackurTetrode: Unit;
        secondRadiation: Unit;
        simplify: Simplify;
        speedOfLight: Unit;
        SQRT1_2: number;
        SQRT2: number;
        stefanBoltzmann: Unit;
        SymbolNode: SymbolNodeCtor;
        tau: number;
        thomsonCrossSection: Unit;
        typed: (
            name: string,
            signatures: Record<string, (...args: any[]) => any>,
        ) => (...args: any[]) => any;
        uninitialized: any;
        Unit: UnitCtor;
        vacuumImpedance: Unit;
        version: string;
        weakMixingAngle: Unit;
        wienDisplacement: Unit;
        abs(x: Complex): number;
        abs<T extends MathType>(x: T): T;
        acos(x: number): number | Complex;
        acos<T extends BigNumber | Complex>(x: T): T;
        acosh(x: number): number | Complex;
        acosh<T extends BigNumber | Complex>(x: T): T;
        acot(x: number): number;
        acot<T extends BigNumber | Complex>(x: T): T;
        acoth(x: number): number;
        acoth<T extends BigNumber | Complex>(x: T): T;
        acsc(x: number): number | Complex;
        acsc<T extends BigNumber | Complex>(x: T): T;
        acsch(x: number): number;
        acsch<T extends BigNumber | Complex>(x: T): T;
        add<T extends MathType>(x: T, y: T): T;
        add<T extends MathType>(x: T, y: T, ...values: T[]): T;
        add(x: MathType, y: MathType): MathType;
        add(x: MathType, y: MathType, ...values: MathType[]): MathType;
        and(
            x:
                | number
                | bigint
                | Unit
                | BigNumber
                | Complex
                | MathCollection<MathNumericType>,
            y:
                | number
                | bigint
                | Unit
                | BigNumber
                | Complex
                | MathCollection<MathNumericType>,
        ): boolean | MathCollection<MathNumericType>;
        arg(x: number | Complex): number;
        arg(x: BigNumber | Complex): BigNumber;
        arg<T extends MathCollection<MathNumericType>>(x: T): T;
        asec(x: number): number | Complex;
        asec<T extends BigNumber | Complex>(x: T): T;
        asech(x: number): number | Complex;
        asech<T extends BigNumber | Complex>(x: T): T;
        asin(x: number): number | Complex;
        asin<T extends BigNumber | Complex>(x: T): T;
        asinh<T extends number | BigNumber | Complex>(x: T): T;
        atan<T extends number | BigNumber | Complex>(x: T): T;
        atan2<T extends number | MathCollection<MathNumericType>>(y: T, x: T): T;
        atanh(x: number): number | Complex;
        atanh<T extends BigNumber | Complex>(x: T): T;
        bellNumbers<T extends number | BigNumber>(n: T): T;
        bernoulli<T extends number | BigNumber | Fraction>(n: T): NoLiteralType<T>;
        bernoulli(n: bigint): Fraction;
        bigint(
            x?: string | number | bigint | boolean | BigNumber | Fraction | null,
        ): bigint;
        bigint<T extends MathCollection<MathNumericType>>(x: T): T;
        bignumber(
            x?:
                | string
                | number
                | bigint
                | boolean
                | Unit
                | BigNumber
                | Fraction
                | null,
        ): BigNumber;
        bignumber<T extends MathCollection<MathNumericType>>(x: T): T;
        bitAnd<
            T extends number
            | bigint
            | BigNumber
            | MathCollection<MathNumericType>,
        >(
            x: T,
            y: number | bigint | BigNumber | MathCollection<MathNumericType>,
        ): NoLiteralType<T>;
        bitNot<
            T extends number
            | bigint
            | BigNumber
            | MathCollection<MathNumericType>,
        >(
            x: T,
        ): T;
        bitOr<
            T extends number
            | bigint
            | BigNumber
            | MathCollection<MathNumericType>,
        >(
            x: T,
            y: T,
        ): T;
        bitXor<
            T extends number
            | bigint
            | BigNumber
            | MathCollection<MathNumericType>,
        >(
            x: T,
            y: number | bigint | BigNumber | MathCollection<MathNumericType>,
        ): NoLiteralType<T>;
        boolean(x: string | number | boolean | null): boolean;
        boolean(x: MathCollection): MathCollection;
        catalan<T extends number | BigNumber>(n: T): T;
        cbrt(x: Complex, allRoots?: boolean): Complex;
        cbrt<T extends number | Unit | BigNumber>(x: T): T;
        ceil<T extends MathNumericType | MathCollection<MathNumericType>>(
            x: T,
            n?: number | BigNumber,
        ): NoLiteralType<T>;
        ceil<U extends MathCollection<MathNumericType>>(
            x: MathNumericType,
            n: U,
        ): U;
        ceil<U extends MathCollection<Unit>>(x: U, unit: Unit): U;
        ceil(x: Unit, unit: Unit): Unit;
        ceil(x: Unit, n: number | BigNumber, unit: Unit): Unit;
        ceil<U extends MathCollection<Unit>>(
            x: U,
            n: number | BigNumber,
            unit: Unit,
        ): U;
        chain<TValue>(value?: TValue): MathJsChain<TValue>;
        clone<TType>(x: TType): TType;
        column<T extends MathCollection<MathNumericType>>(
            value: T,
            column: number,
        ): T;
        combinations<T extends number | BigNumber>(
            n: T,
            k: number | BigNumber,
        ): NoLiteralType<T>;
        compare(
            x: string | MathType,
            y: string | MathType,
        ): number | BigNumber | Fraction | MathCollection<MathNumericType>;
        compareNatural(x: any, y: any): number;
        compareText(
            x: string | MathCollection<MathNumericType>,
            y: string | MathCollection<MathNumericType>,
        ): number | MathCollection<MathNumericType>;
        compile(expr: MathExpression): EvalFunction;
        compile(exprs: MathExpression[]): EvalFunction[];
        complex(arg?: string | MathNumericType | PolarCoordinates): Complex;
        complex(arg?: MathCollection<MathNumericType>): MathCollection;
        complex(re: number, im: number): Complex;
        composition<T extends number | BigNumber>(
            n: T,
            k: number | BigNumber,
        ): NoLiteralType<T>;
        concat(
            ...args: (number | BigNumber | MathCollection<MathNumericType>)[],
        ): MathCollection;
        conj<
            T extends
                number
                | BigNumber
                | Complex
                | MathCollection<MathNumericType>,
        >(
            x: T,
        ): NoLiteralType<T>;
        corr(x: MathCollection, y: MathCollection): MathType;
        cos(x: number | Unit): number;
        cos<T extends BigNumber | Complex>(x: T): T;
        cosh(x: number | Unit): number;
        cosh<T extends BigNumber | Complex>(x: T): T;
        cot(x: number | Unit): number;
        cot<T extends BigNumber | Complex>(x: T): T;
        coth(x: number | Unit): number;
        coth<T extends BigNumber | Complex>(x: T): T;
        count(x: string | MathCollection<MathNumericType>): number;
        createUnit(
            name: string,
            definition?: string | Unit | UnitDefinition,
            options?: CreateUnitOptions,
        ): Unit;
        createUnit(
            units: Record<string, string | UnitDefinition | Unit>,
            options?: CreateUnitOptions,
        ): Unit;
        cross(x: MathCollection, y: MathCollection): MathCollection;
        csc(x: number | Unit): number;
        csc<T extends BigNumber | Complex>(x: T): T;
        csch(x: number | Unit): number;
        csch<T extends BigNumber | Complex>(x: T): T;
        ctranspose(x: MathCollection): MathCollection;
        cube<T extends Unit | MathNumericType>(x: T): T;
        cumsum(...args: MathType[]): MathType[];
        cumsum(array: MathCollection, dim?: number): MathCollection;
        deepEqual(x: MathType, y: MathType): MathType;
        derivative(
            expr: string | MathNode,
            variable: string | MathNode,
            options?: { simplify: boolean },
        ): MathNode;
        det(x: MathCollection): number;
        diag(X: MathCollection, format?: string): Matrix;
        diag(
            X: MathCollection,
            k: number | BigNumber,
            format?: string,
        ): MathCollection;
        diff<T extends MathCollection<MathNumericType>>(
            x: T,
            dim?: number | BigNumber,
        ): T;
        distance(
            x: object | MathCollection<MathNumericType>,
            y: object | MathCollection<MathNumericType>,
            z?: object | MathCollection<MathNumericType>,
        ): number | BigNumber;
        divide(x: Unit, y: Unit): number | Unit;
        divide(x: Unit, y: number): Unit;
        divide(x: number, y: number): number;
        divide(x: MathType, y: MathType): MathType;
        dot(x: MathCollection, y: MathCollection): number;
        dotDivide<T extends MathCollection<MathNumericType>>(x: T, y: MathType): T;
        dotDivide<T extends MathCollection<MathNumericType>>(x: MathType, y: T): T;
        dotDivide(x: Unit, y: MathType): Unit;
        dotDivide(x: MathType, y: Unit): Unit;
        dotDivide(x: MathNumericType, y: MathNumericType): MathNumericType;
        dotMultiply<T extends MathCollection<MathNumericType>>(
            x: T,
            y: MathType,
        ): T;
        dotMultiply<T extends MathCollection<MathNumericType>>(
            x: MathType,
            y: T,
        ): T;
        dotMultiply(x: Unit, y: MathType): Unit;
        dotMultiply(x: MathType, y: Unit): Unit;
        dotMultiply(x: MathNumericType, y: MathNumericType): MathNumericType;
        dotPow<T extends MathType>(x: T, y: MathType): T;
        eigs(
            x: MathCollection,
            opts?:
                | number
                | BigNumber
                | { eigenvectors?: true; precision?: number
                | BigNumber },
        ): {
            eigenvectors: { value: number | BigNumber; vector: MathCollection }[];
            values: MathCollection;
        };
        eigs(
            x: MathCollection,
            opts: { eigenvectors: false; precision?: number | BigNumber },
        ): { values: MathCollection };
        equal(
            x: string | MathType,
            y: string | MathType,
        ): boolean | MathCollection<MathNumericType>;
        equalText(
            x: string | MathCollection<MathNumericType>,
            y: string | MathCollection<MathNumericType>,
        ): number | MathCollection<MathNumericType>;
        erf<T extends number | MathCollection<MathNumericType>>(
            x: T,
        ): NoLiteralType<T>;
        evaluate(expr: MathExpression, scope?: MathScope<any>): any;
        evaluate(expr: MathExpression[], scope?: MathScope<any>): any[];
        exp<T extends number | BigNumber | Complex>(x: T): T;
        expm(x: Matrix): Matrix;
        expm1<T extends number | BigNumber | Complex>(x: T): T;
        factorial<T extends number | BigNumber | MathCollection<MathNumericType>>(
            n: T,
        ): NoLiteralType<T>;
        fft<T extends MathCollection<MathNumericType>>(arr: T): T;
        filter(
            x: string[] | MathCollection<MathNumericType>,
            test:
                | RegExp
                | (
                    (
                        value: any,
                        index: number[],
                        matrix: string[] | MathCollection<MathNumericType>,
                    ) => boolean
                ),
        ): MathCollection;
        fix<T extends MathNumericType | MathCollection<MathNumericType>>(
            x: T,
            n?: number | BigNumber,
        ): NoLiteralType<T>;
        fix<U extends MathCollection<MathNumericType>>(x: MathNumericType, n: U): U;
        fix<U extends MathCollection<Unit>>(x: U, unit: Unit): U;
        fix(x: Unit, unit: Unit): Unit;
        fix(x: Unit, n: number | BigNumber, unit: Unit): Unit;
        fix<U extends MathCollection<Unit>>(
            x: U,
            n: number | BigNumber,
            unit: Unit,
        ): U;
        flatten<T extends MathCollection<MathNumericType>>(x: T): T;
        floor<T extends MathNumericType | MathCollection<MathNumericType>>(
            x: T,
            n?: number | BigNumber,
        ): NoLiteralType<T>;
        floor<U extends MathCollection<MathNumericType>>(
            x: MathNumericType,
            n: U,
        ): U;
        floor<U extends MathCollection<Unit>>(x: U, unit: Unit): U;
        floor(x: Unit, unit: Unit): Unit;
        floor(x: Unit, n: number | BigNumber, unit: Unit): Unit;
        floor<U extends MathCollection<Unit>>(
            x: U,
            n: number | BigNumber,
            unit: Unit,
        ): U;
        forEach<T extends MathCollection<MathNumericType>>(
            x: T,
            callback: (value: any, index: number[], matrix: T) => void,
        ): void;
        format(
            value: any,
            options?: number | BigNumber | FormatOptions | ((item: any) => string),
            callback?: (value: any) => string,
        ): string;
        fraction(
            value:
                | string
                | number
                | bigint
                | Unit
                | BigNumber
                | Fraction
                | FractionDefinition,
        ): Fraction;
        fraction(values: MathCollection): MathCollection;
        fraction(numerator: bigint, denominator: bigint): Fraction;
        fraction(numerator: number, denominator: number): Fraction;
        freqz<T extends MathCollection<MathNumericType>>(
            b: T,
            a: T,
            w?: number | T,
        ): { h: T; w: T };
        gamma<T extends number | BigNumber | Complex>(n: T): NoLiteralType<T>;
        gcd<
            T extends
                number
                | BigNumber
                | Fraction
                | MathCollection<MathNumericType>,
        >(
            ...args: T[],
        ): T;
        gcd<T extends number | BigNumber | Fraction | Matrix<MathNumericType>>(
            args: T[],
        ): T;
        getMatrixDataType(m: MathCollection): string;
        hasNumericValue(x: any): boolean | boolean[];
        help(search: () => any): Help;
        hypot<T extends number | BigNumber>(...args: T[]): T;
        hypot<T extends number | BigNumber>(args: T[]): T;
        identity(
            size: number | number[] | MathCollection<MathNumericType>,
            format?: string,
        ): number | MathCollection<MathNumericType>;
        identity(
            m: number,
            n: number,
            format?: string,
        ): number | MathCollection<MathNumericType>;
        ifft<T extends MathCollection<MathNumericType>>(arr: T): T;
        im(x: MathJsChain<number | Complex>): MathJsChain<number>;
        im<T extends BigNumber | MathCollection<MathNumericType>>(
            x: MathJsChain<T>,
        ): MathJsChain<T>;
        import(
            object: ImportObject | ImportObject[],
            options?: ImportOptions,
        ): void;
        index(...ranges: any[]): Index;
        intersect(
            w: MathCollection,
            x: MathCollection,
            y: MathCollection,
            z?: MathCollection<MathNumericType>,
        ): MathArray;
        inv<T extends number | Complex | MathCollection<MathNumericType>>(
            x: T,
        ): NoLiteralType<T>;
        isAccessorNode(x: unknown): x is AccessorNode<MathNode>;
        isArrayNode(x: unknown): x is ArrayNode<MathNode[]>;
        isAssignmentNode(x: unknown): x is AssignmentNode<MathNode>;
        isBigInt(x: unknown): x is bigint;
        isBigNumber(x: unknown): x is BigNumber;
        isBlockNode(x: unknown): x is BlockNode<MathNode>;
        isBoolean(x: unknown): x is boolean;
        isBounded(x: MathType): boolean;
        isChain(x: unknown): x is MathJsChain<unknown>;
        isCollection(x: unknown): x is any[] | Matrix<MathNumericType>;
        isComplex(x: unknown): x is Complex;
        isConditionalNode(
            x: unknown,
        ): x is ConditionalNode<MathNode, MathNode, MathNode>;
        isConstantNode(x: unknown): x is ConstantNode<number>;
        isDate(x: unknown): x is Date;
        isDenseMatrix(x: unknown): x is Matrix<MathNumericType>;
        isFinite(x: MathScalarType): boolean;
        isFinite(A: MathCollection): MathCollection;
        isFraction(x: unknown): x is Fraction;
        isFunction(x: unknown): boolean;
        isFunctionAssignmentNode(x: unknown): x is FunctionAssignmentNode<MathNode>;
        isFunctionNode(x: unknown): x is FunctionNode<SymbolNode, MathNode[]>;
        isHelp(x: unknown): x is Help;
        isIndex(x: unknown): x is Index;
        isIndexNode(x: unknown): x is IndexNode<MathNode[]>;
        isInteger(
            x: number | BigNumber | Fraction | MathCollection<MathNumericType>,
        ): boolean;
        isMap<T, U>(x: unknown): x is Map<T, U>;
        isMatrix(x: unknown): x is Matrix<MathNumericType>;
        isNaN(
            x:
                | number
                | bigint
                | Unit
                | BigNumber
                | Fraction
                | MathCollection<MathNumericType>,
        ): boolean;
        isNegative(
            x:
                | number
                | bigint
                | Unit
                | BigNumber
                | Fraction
                | MathCollection<MathNumericType>,
        ): boolean;
        isNode(x: unknown): x is MathNode;
        isNull(x: unknown): x is null;
        isNumber(x: unknown): x is number;
        isNumeric(x: any): x is number | bigint | boolean | BigNumber | Fraction;
        isObject(x: unknown): boolean;
        isObjectNode(x: unknown): x is ObjectNode<Record<string, MathNode>>;
        isObjectWrappingMap<T extends string | number | symbol, U>(
            x: unknown,
        ): x is ObjectWrappingMap<T, U>;
        isOperatorNode(
            x: unknown,
        ): x is OperatorNode<OperatorNodeOp, keyof OperatorNodeMap, MathNode[]>;
        isParenthesisNode(x: unknown): x is ParenthesisNode<MathNode>;
        isPartitionedMap<T, U>(x: unknown): x is PartitionedMap<T, U>;
        isPositive(
            x:
                | number
                | bigint
                | Unit
                | BigNumber
                | Fraction
                | MathCollection<MathNumericType>,
        ): boolean;
        isPrime(x: number | BigNumber | MathCollection<MathNumericType>): boolean;
        isRange(x: unknown): boolean;
        isRangeNode(x: unknown): x is RangeNode<MathNode, MathNode, MathNode>;
        isRegExp(x: unknown): x is RegExp;
        isRelationalNode(x: unknown): x is RelationalNode<MathNode[]>;
        isResultSet(x: unknown): x is ResultSet;
        isSparseMatrix(x: unknown): x is Matrix<MathNumericType>;
        isString(x: unknown): x is string;
        isSymbolNode(x: unknown): x is SymbolNode;
        isUndefined(x: unknown): x is undefined;
        isUnit(x: unknown): x is Unit;
        isZero(x: MathType): boolean;
        kldivergence(q: MathCollection, p: MathCollection): number;
        kron(x: MathCollection, y: MathCollection): Matrix;
        larger(
            x: string | MathType,
            y: string | MathType,
        ): boolean | MathCollection<MathNumericType>;
        largerEq(
            x: string | MathType,
            y: string | MathType,
        ): boolean | MathCollection<MathNumericType>;
        lcm<T extends number | BigNumber | MathCollection<MathNumericType>>(
            a: T,
            b: T,
        ): T;
        leafCount(expr: MathNode): number;
        leftShift<
            T extends number
            | bigint
            | BigNumber
            | MathCollection<MathNumericType>,
        >(
            x: T,
            y: number | bigint | BigNumber,
        ): NoLiteralType<T>;
        lgamma<T extends number | Complex>(n: T): NoLiteralType<T>;
        log<T extends number | BigNumber | Complex>(
            x: T,
            base?: number | BigNumber | Complex,
        ): NoLiteralType<T>;
        log10<
            T extends
                number
                | BigNumber
                | Complex
                | MathCollection<MathNumericType>,
        >(
            x: T,
        ): T;
        log1p<
            T extends
                number
                | BigNumber
                | Complex
                | MathCollection<MathNumericType>,
        >(
            x: T,
            base?: number | BigNumber | Complex,
        ): T;
        log2<
            T extends
                number
                | BigNumber
                | Complex
                | MathCollection<MathNumericType>,
        >(
            x: T,
        ): T;
        lsolve(L: Matrix, b: MathCollection): Matrix;
        lsolve(L: MathArray, b: MathCollection): MathArray;
        lup(A?: MathCollection<MathNumericType>): LUDecomposition;
        lusolve(
            A: Matrix,
            b: MathCollection,
            order?: number,
            threshold?: number,
        ): Matrix;
        lusolve(
            A: MathArray,
            b: MathCollection,
            order?: number,
            threshold?: number,
        ): MathArray;
        lusolve(A: LUDecomposition, b: MathCollection): Matrix;
        lyap(A: MathCollection, Q: MathCollection): MathCollection;
        mad(array: MathCollection): any;
        map<T extends MathCollection<MathNumericType>>(
            x: T,
            callback: (value: any, index: number[], matrix: T) => string | MathType,
        ): T;
        map<T extends MathCollection<MathNumericType>>(
            x: T,
            ...args: (T | ((value: any, ...args: any[]) => string | MathType))[],
        ): T;
        mapSlices<T extends MathCollection<MathNumericType>>(
            array: T,
            dim: number,
            callback: (array: MathCollection) => number,
        ): T;
        matrix(format?: MatrixStorageFormat): Matrix;
        matrix(
            data: string[] | MathCollection<MathNumericType>,
            format?: MatrixStorageFormat,
            dataType?: string,
        ): Matrix;
        matrix<T extends MathScalarType>(
            data: MathCollection<T>,
            format?: MatrixStorageFormat,
            dataType?: string,
        ): Matrix<T>;
        matrixFromColumns(...cols: Matrix<MathNumericType>[]): Matrix;
        matrixFromColumns<T extends MathScalarType>(
            ...cols: (Matrix<MathNumericType> | T[] | [T][])[],
        ): T[][];
        matrixFromFunction<T extends MathScalarType>(
            size: [number],
            fn: MatrixFromFunctionCallback<T>,
        ): T[];
        matrixFromFunction<T extends MathScalarType>(
            size: [number, number],
            fn: MatrixFromFunctionCallback<T>,
        ): T[][];
        matrixFromFunction<T extends MathScalarType>(
            size: number[],
            fn: MatrixFromFunctionCallback<T>,
        ): MathArray<T>;
        matrixFromFunction(
            size: Matrix<number>,
            fn: MatrixFromFunctionCallback<MathScalarType>,
        ): Matrix;
        matrixFromFunction(
            size: number[] | Matrix<number>,
            fn: MatrixFromFunctionCallback<MathScalarType>,
            format: MatrixStorageFormat,
            datatype?: string,
        ): Matrix;
        matrixFromFunction(
            size: number[] | Matrix<number>,
            format: MatrixStorageFormat,
            fn: MatrixFromFunctionCallback<MathScalarType>,
            datatype?: string,
        ): Matrix;
        matrixFromRows(...rows: Matrix<MathNumericType>[]): Matrix;
        matrixFromRows<T extends MathScalarType>(
            ...rows: (Matrix<MathNumericType> | T[] | [T][])[],
        ): T[][];
        max<T extends MathScalarType>(...args: T[]): T;
        max(...args: MathScalarType[]): MathScalarType;
        max<T extends MathScalarType>(
            A: T[] | T[][],
            dimension?: number | BigNumber,
        ): T;
        max(A: MathCollection, dimension?: number | BigNumber): MathScalarType;
        mean<T extends MathScalarType>(...args: T[]): T;
        mean(...args: MathScalarType[]): MathScalarType;
        mean<T extends MathScalarType>(
            A: T[] | T[][],
            dimension?: number | BigNumber,
        ): T;
        mean(A: MathCollection, dimension?: number | BigNumber): MathScalarType;
        median<T extends MathScalarType>(...args: T[]): T;
        median(...args: MathScalarType[]): MathScalarType;
        median<T extends MathScalarType>(A: T[] | T[][]): T;
        median(A: MathCollection): MathScalarType;
        min<T extends MathScalarType>(...args: T[]): T;
        min(...args: MathScalarType[]): MathScalarType;
        min<T extends MathScalarType>(
            A: T[] | T[][],
            dimension?: number | BigNumber,
        ): T;
        min(A: MathCollection, dimension?: number | BigNumber): MathScalarType;
        mod<
            T extends
                | number
                | bigint
                | BigNumber
                | Fraction
                | MathCollection<MathNumericType>,
        >(
            x: T,
            y:
                | number
                | bigint
                | BigNumber
                | Fraction
                | MathCollection<MathNumericType>,
        ): NoLiteralType<T>;
        mode<T extends MathScalarType>(...args: T[]): T[];
        mode(...args: MathScalarType[]): MathScalarType[];
        mode<T extends MathScalarType>(A: T[] | T[][]): T[];
        mode(A: MathCollection): MathScalarType[];
        multinomial<T extends number | BigNumber>(a: T[]): NoLiteralType<T>;
        multiply<T extends Matrix<MathNumericType>>(x: T, y: MathType): Matrix;
        multiply<T extends Matrix<MathNumericType>>(x: MathType, y: T): Matrix;
        multiply<T extends MathArray<MathNumericType>>(x: T, y: T[]): T;
        multiply<T extends MathArray<MathNumericType>>(x: T[], y: T): T;
        multiply<T extends MathArray<MathNumericType>>(x: T[], y: T[]): T[];
        multiply<T extends MathArray<MathNumericType>>(x: T, y: T): MathScalarType;
        multiply(x: Unit, y: Unit): Unit;
        multiply(x: number, y: number): number;
        multiply(x: MathType, y: MathType, ...values: MathType[]): MathType;
        multiply<T extends MathType>(x: T, y: T, ...values: T[]): T;
        norm(
            x: number | BigNumber | Complex | MathCollection<MathNumericType>,
            p?: string | number | BigNumber,
        ): number | BigNumber;
        not(
            x:
                | number
                | bigint
                | Unit
                | BigNumber
                | Complex
                | MathCollection<MathNumericType>,
        ): boolean | MathCollection<MathNumericType>;
        nthRoot(
            a: number | BigNumber | Complex,
            root?: number | BigNumber,
        ): number | Complex;
        nthRoot(M: MathCollection, root?: number | BigNumber): MathCollection;
        nthRoots(a: number | BigNumber | Complex, n?: number): Complex[];
        number(
            value?:
                | string
                | number
                | bigint
                | boolean
                | Unit
                | BigNumber
                | Fraction
                | null,
        ): number;
        number(
            value?: MathCollection<MathNumericType>,
        ): number | MathCollection<MathNumericType>;
        number(unit: Unit, valuelessUnit: string | Unit): number;
        numeric(
            value: string | number | bigint | BigNumber | Fraction,
            outputType: "number",
        ): number;
        numeric(
            value: string | number | bigint | BigNumber | Fraction,
            outputType: "BigNumber",
        ): BigNumber;
        numeric(
            value: string | number | bigint | BigNumber | Fraction,
            outputType: "bigint",
        ): bigint;
        numeric(
            value: string | number | bigint | BigNumber | Fraction,
            outputType: "Fraction",
        ): Fraction;
        ones(
            size?: number | number[] | BigNumber | BigNumber[],
            format?: string,
        ): MathCollection;
        ones(
            m: number | BigNumber,
            n: number | BigNumber,
            format?: string,
        ): MathCollection;
        ones(
            m: number | BigNumber,
            n: number | BigNumber,
            p: number | BigNumber,
            format?: string,
        ): MathCollection;
        or(
            x:
                | number
                | bigint
                | Unit
                | BigNumber
                | Complex
                | MathCollection<MathNumericType>,
            y:
                | number
                | bigint
                | Unit
                | BigNumber
                | Complex
                | MathCollection<MathNumericType>,
        ): boolean | MathCollection<MathNumericType>;
        parser(): Parser;
        partitionSelect(
            x: MathCollection,
            k: number,
            compare?: "desc" | "asc" | ((a: any, b: any) => number),
        ): any;
        permutations<T extends number | BigNumber>(
            n: T,
            k?: number | BigNumber,
        ): NoLiteralType<T>;
        pickRandom<T>(array: T[]): T;
        pickRandom<T>(array: T[], number: number): T[];
        pickRandom<T>(array: T[], number: number, weights: number[]): T[];
        pinv<T extends MathType>(x: T): T;
        polynomialRoot(
            constantCoeff: number | Complex,
            linearCoeff: number | Complex,
            quadraticCoeff?: number | Complex,
            cubicCoeff?: number | Complex,
        ): (number | Complex)[];
        pow(x: MathType, y: number | bigint | BigNumber | Complex): MathType;
        print(
            template: string,
            values: any,
            precision?: number,
            options?: number | object,
        ): void;
        prod<T extends MathScalarType>(...args: T[]): T;
        prod(...args: MathScalarType[]): MathScalarType;
        prod<T extends MathScalarType>(A: T[] | T[][]): T;
        prod(A: MathCollection): MathScalarType;
        qr(A: MathCollection): QRDecomposition;
        quantileSeq<T extends MathScalarType>(
            A: T[] | T[][],
            prob: number | BigNumber,
            sorted?: boolean,
        ): T;
        quantileSeq(
            A: MathCollection,
            prob: number | BigNumber | MathArray<MathNumericType>,
            sorted?: boolean,
        ): MathArray<MathNumericType> | MathScalarType;
        random(min?: number, max?: number): number;
        random<T extends MathCollection<MathNumericType>>(
            size: T,
            min?: number,
            max?: number,
        ): T;
        randomInt(min: number, max?: number): number;
        randomInt<T extends MathCollection<MathNumericType>>(
            size: T,
            min?: number,
            max?: number,
        ): T;
        range(str: string, includeEnd?: boolean): Matrix;
        range(
            start: number | BigNumber,
            end: number | BigNumber,
            includeEnd?: boolean,
        ): Matrix;
        range(
            start: number | Unit | BigNumber,
            end: number | Unit | BigNumber,
            step: number | Unit | BigNumber,
            includeEnd?: boolean,
        ): Matrix;
        rationalize(
            expr: string | MathNode,
            optional?: boolean | object,
            detailed?: false,
        ): MathNode;
        rationalize(
            expr: string | MathNode,
            optional?: boolean | object,
            detailed?: true,
        ): {
            coefficients: MathType[];
            expression: string | MathNode;
            variables: string[];
        };
        re(x: MathJsChain<number | Complex>): MathJsChain<number>;
        re<T extends BigNumber | MathCollection<MathNumericType>>(
            x: MathJsChain<T>,
        ): MathJsChain<T>;
        replacer(): (key: any, value: any) => any;
        reshape<T extends MathCollection<MathNumericType>>(
            x: T,
            sizes: number[],
        ): T;
        resize<T extends MathCollection<MathNumericType>>(
            x: T,
            size: MathCollection,
            defaultValue?: string | number,
        ): T;
        resolve(node: string | MathNode, scope?: MathScope<any>): MathNode;
        resolve(node: (string | MathNode)[], scope?: MathScope<any>): MathNode[];
        resolve(node: Matrix, scope?: MathScope<any>): Matrix;
        reviver(): (key: any, value: any) => any;
        rightArithShift<
            T extends number
            | bigint
            | BigNumber
            | MathCollection<MathNumericType>,
        >(
            x: T,
            y: number | bigint | BigNumber,
        ): NoLiteralType<T>;
        rightLogShift<T extends number | MathCollection<MathNumericType>>(
            x: T,
            y: number,
        ): NoLiteralType<T>;
        rotate<T extends MathCollection<MathNumericType>>(
            w: T,
            theta: number | Unit | BigNumber | Complex,
            v?: T,
        ): T;
        rotationMatrix<T extends MathCollection<MathNumericType>>(
            theta?: number | Unit | BigNumber | Complex,
            axis?: T,
            format?: "sparse" | "dense",
        ): T;
        round<T extends MathNumericType | MathCollection<MathNumericType>>(
            x: T,
            n?: number | BigNumber,
        ): NoLiteralType<T>;
        round<U extends MathCollection<MathNumericType>>(
            x: MathNumericType,
            n: U,
        ): U;
        round<U extends MathCollection<Unit>>(x: U, unit: Unit): U;
        round(x: Unit, unit: Unit): Unit;
        round(x: Unit, n: number | BigNumber, unit: Unit): Unit;
        round<U extends MathCollection<Unit>>(
            x: U,
            n: number | BigNumber,
            unit: Unit,
        ): U;
        row<T extends MathCollection<MathNumericType>>(value: T, row: number): T;
        schur(A: MathCollection): SchurDecomposition;
        sec(x: number | Unit): number;
        sec<T extends BigNumber | Complex>(x: T): T;
        sech(x: number | Unit): number;
        sech<T extends BigNumber | Complex>(x: T): T;
        setCartesian<T extends MathCollection<MathNumericType>>(
            a1: T,
            a2: MathCollection,
        ): T;
        setDifference<T extends MathCollection<MathNumericType>>(
            a1: T,
            a2: MathCollection,
        ): T;
        setDistinct<T extends MathCollection<MathNumericType>>(a: T): T;
        setIntersect<T extends MathCollection<MathNumericType>>(
            a1: T,
            a2: MathCollection,
        ): T;
        setIsSubset(a1: MathCollection, a2: MathCollection): boolean;
        setMultiplicity(e: MathNumericType, a: MathCollection): number;
        setPowerset<T extends MathCollection<MathNumericType>>(a: T): T;
        setSize(a: MathCollection): number;
        setSymDifference<T extends MathCollection<MathNumericType>>(
            a1: T,
            a2: MathCollection,
        ): T;
        setUnion<T extends MathCollection<MathNumericType>>(
            a1: T,
            a2: MathCollection,
        ): T;
        sign<T extends MathType>(x: T): T;
        simplifyConstant(
            expr: string | MathNode,
            options?: SimplifyOptions,
        ): MathNode;
        simplifyCore(expr: string | MathNode, options?: SimplifyOptions): MathNode;
        sin(x: number | Unit): number;
        sin<T extends BigNumber | Complex>(x: T): T;
        sinh(x: number | Unit): number;
        sinh<T extends BigNumber | Complex>(x: T): T;
        size(
            x:
                | string
                | number
                | boolean
                | Unit
                | Complex
                | MathCollection<MathNumericType>,
        ): MathCollection;
        slu(A: Matrix, order: number, threshold: number): SLUDecomposition;
        smaller(
            x: string | MathType,
            y: string | MathType,
        ): boolean | MathCollection<MathNumericType>;
        smallerEq(
            x: string | MathType,
            y: string | MathType,
        ): boolean | MathCollection<MathNumericType>;
        sort<T extends MathCollection<MathNumericType>>(
            x: T,
            compare: "desc" | "asc" | ((a: any, b: any) => number) | "natural",
        ): T;
        sparse(data?: MathCollection<MathNumericType>, dataType?: string): Matrix;
        splitUnit(unit: Unit, parts: Unit[]): Unit[];
        sqrt(x: number): number | Complex;
        sqrt<T extends Unit | BigNumber | Complex>(x: T): T;
        sqrtm<T extends MathCollection<MathNumericType>>(A: T): T;
        square<T extends Unit | MathNumericType>(x: T): T;
        squeeze<T extends MathCollection<MathNumericType>>(x: T): T;
        std<T extends MathScalarType>(...args: T[]): T;
        std(...args: MathScalarType[]): MathScalarType;
        std(
            array: MathCollection,
            dimension?: number,
            normalization?: "unbiased" | "uncorrected" | "biased",
        ): MathNumericType[];
        std(
            array: MathCollection,
            normalization: "unbiased" | "uncorrected" | "biased",
        ): MathNumericType;
        stirlingS2<T extends number | BigNumber>(
            n: T,
            k: number | BigNumber,
        ): NoLiteralType<T>;
        string(value: string | Unit | MathNumericType | null): string;
        string(value: MathCollection): MathCollection;
        subset<T extends string | MathCollection<MathNumericType>>(
            value: T,
            index: Index,
            replacement?: any,
            defaultValue?: any,
        ): T;
        subtract<T extends MathType>(x: T, y: T): T;
        subtract(x: MathType, y: MathType): MathType;
        sum<T extends MathScalarType>(...args: T[]): T;
        sum(...args: MathScalarType[]): MathScalarType;
        sum<T extends MathScalarType>(
            A: T[] | T[][],
            dimension?: number | BigNumber,
        ): T;
        sum(A: MathCollection, dimension?: number | BigNumber): MathScalarType;
        sylvester(
            A: MathCollection,
            B: MathCollection,
            C: MathCollection,
        ): MathCollection;
        symbolicEqual(
            expr1: MathNode,
            expr2: MathNode,
            options?: SimplifyOptions,
        ): boolean;
        tan(x: number | Unit): number;
        tan<T extends BigNumber | Complex>(x: T): T;
        tanh(x: number | Unit): number;
        tanh<T extends BigNumber | Complex>(x: T): T;
        to(
            x: Unit | MathCollection<MathNumericType>,
            unit: string | Unit,
        ): Unit | MathCollection<MathNumericType>;
        toBest(): Unit;
        toBest(units: string[] | Unit[], options: object): Unit;
        trace(x: MathCollection): number;
        transpose<T extends MathCollection<MathNumericType>>(x: T): T;
        typeOf(x: any): string;
        unaryMinus<T extends MathType>(x: T): T;
        unaryPlus<T extends string | MathType>(x: T): T;
        unequal(
            x: string | MathType,
            y: string | MathType,
        ): boolean | MathCollection<MathNumericType>;
        unit(unit: string): Unit;
        unit(unit: Unit): Unit;
        unit(value: MathNumericType, unit?: string): Unit;
        unit(value: MathCollection): Unit[];
        usolve(U: Matrix, b: MathCollection): Matrix;
        usolve(U: MathArray, b: MathCollection): MathArray;
        variance(...args: MathNumericType[]): MathNumericType;
        variance(
            array: MathCollection,
            dimension?: number,
            normalization?: "unbiased" | "uncorrected" | "biased",
        ): MathNumericType[];
        variance(
            array: MathCollection,
            normalization: "unbiased" | "uncorrected" | "biased",
        ): MathNumericType;
        xgcd(a: number | BigNumber, b: number | BigNumber): MathArray;
        xor(
            x:
                | number
                | bigint
                | Unit
                | BigNumber
                | Complex
                | MathCollection<MathNumericType>,
            y:
                | number
                | bigint
                | Unit
                | BigNumber
                | Complex
                | MathCollection<MathNumericType>,
        ): boolean | MathCollection<MathNumericType>;
        zeros(
            size?: number | number[] | BigNumber | BigNumber[],
            format?: string,
        ): MathCollection;
        zeros(
            m: number | BigNumber,
            n: number | BigNumber,
            format?: string,
        ): MathCollection;
        zeros(
            m: number | BigNumber,
            n: number | BigNumber,
            p: number | BigNumber,
            format?: string,
        ): MathCollection;
        zeta<T extends number | BigNumber | Complex>(s: T): T;
        zpk2tf<T extends MathCollection<MathNumericType>>(
            z: T,
            p: T,
            k?: number,
        ): T;
    }

    Hierarchy (View Summary)

    Index

    Properties

    Methods

    abs acos acosh acot acoth acsc acsch add and arg asec asech asin asinh atan atan2 atanh bellNumbers bernoulli bigint bignumber bitAnd bitNot bitOr bitXor boolean catalan cbrt ceil chain clone column combinations compare compareNatural compareText compile complex composition concat conj corr cos cosh cot coth count createUnit cross csc csch ctranspose cube cumsum deepEqual derivative det diag diff distance divide dot dotDivide dotMultiply dotPow eigs equal equalText erf evaluate exp expm expm1 factorial fft filter fix flatten floor forEach format fraction freqz gamma gcd getMatrixDataType hasNumericValue help hypot identity ifft im import index intersect inv isAccessorNode isArrayNode isAssignmentNode isBigInt isBigNumber isBlockNode isBoolean isBounded isChain isCollection isComplex isConditionalNode isConstantNode isDate isDenseMatrix isFinite isFraction isFunction isFunctionAssignmentNode isFunctionNode isHelp isIndex isIndexNode isInteger isMap isMatrix isNaN isNegative isNode isNull isNumber isNumeric isObject isObjectNode isObjectWrappingMap isOperatorNode isParenthesisNode isPartitionedMap isPositive isPrime isRange isRangeNode isRegExp isRelationalNode isResultSet isSparseMatrix isString isSymbolNode isUndefined isUnit isZero kldivergence kron larger largerEq lcm leafCount leftShift lgamma log log10 log1p log2 lsolve lup lusolve lyap mad map mapSlices matrix matrixFromColumns matrixFromFunction matrixFromRows max mean median min mod mode multinomial multiply norm not nthRoot nthRoots number numeric ones or parser partitionSelect permutations pickRandom pinv polynomialRoot pow print prod qr quantileSeq random randomInt range rationalize re replacer reshape resize resolve reviver rightArithShift rightLogShift rotate rotationMatrix round row schur sec sech setCartesian setDifference setDistinct setIntersect setIsSubset setMultiplicity setPowerset setSize setSymDifference setUnion sign simplifyConstant simplifyCore sin sinh size slu smaller smallerEq sort sparse splitUnit sqrt sqrtm square squeeze std stirlingS2 string subset subtract sum sylvester symbolicEqual tan tanh to toBest trace transpose typeOf unaryMinus unaryPlus unequal unit usolve variance xgcd xor zeros zeta zpk2tf

    Properties

    AccessorNode: AccessorNodeCtor
    apply: <T extends MathCollection<MathNumericType>>(
        array: T,
        dim: number,
        callback: (array: MathCollection) => number,
    ) => T

    Type Declaration

      • <T extends MathCollection<MathNumericType>>(
            array: T,
            dim: number,
            callback: (array: MathCollection) => number,
        ): T
      • Apply a function that maps an array to a scalar along a given axis of a matrix or array. Returns a new matrix or array with one less dimension than the input.

        Type Parameters

        Parameters

        • array: T

          The input Matrix

        • dim: number

          The dimension along which the callback is applied

        • callback: (array: MathCollection) => number

          The callback function that is applied. This Function should take an array or 1-d matrix as an input and return a number.

        Returns T

        The residual matrix with the function applied over some dimension.

    backwards-compatibility old name of mapSlices

    ArrayNode: ArrayNodeCtor
    AssignmentNode: AssignmentNodeCtor
    atomicMass: Unit
    avogadro: Unit
    BlockNode: BlockNodeCtor
    bohrMagneton: Unit
    bohrRadius: Unit
    boltzmann: Unit
    classicalElectronRadius: Unit
    ConditionalNode: ConditionalNodeCtor
    conductanceQuantum: Unit
    config: (options: ConfigOptions) => ConfigOptions

    Set configuration options for math.js, and get current options. Will emit a ‘config’ event, with arguments (curr, prev, changes).

    Type Declaration

      • (options: ConfigOptions): ConfigOptions
      • Parameters

        • options: ConfigOptions

          Available options: {number} relTol Minimum relative difference between two compared values, used by all comparison functions. {number} absTol Minimum absolute difference between two compared values, used by all comparison functions. {string} matrix A string ‘Matrix’ (default) or ‘Array’. {string} number A string ‘number’ (default), ‘BigNumber’, or ‘Fraction’ {number} precision The number of significant digits for BigNumbers. Not applicable for Numbers. {string} parenthesis How to display parentheses in LaTeX and string output. {string} randomSeed Random seed for seeded pseudo random number generator. Set to null to randomly seed.

        Returns ConfigOptions

        Returns the current configuration

    ConstantNode: ConstantNodeCtor
    coulomb: Unit
    create: (
        factories: FactoryFunctionMap,
        config?: ConfigOptions,
    ) => MathJsInstance
    deuteronMass: Unit
    e: number
    efimovFactor: Unit
    electricConstant: Unit
    electronMass: Unit
    elementaryCharge: Unit
    expression: MathNode
    factory: <T, TDeps extends readonly (keyof MathJsInstance)[]>(
        name: string,
        dependencies: TDeps,
        create: (
            injected: Pick<
                MathJsInstance,
                Extract<MathJsFunctionName, TDeps[number]>,
            >,
        ) => T,
        meta?: any,
    ) => FactoryFunction<T>
    faraday: Unit
    fermiCoupling: Unit
    fineStructure: Unit
    firstRadiation: Unit
    FunctionAssignmentNode: FunctionAssignmentNodeCtor
    FunctionNode: FunctionNodeCtor
    gasConstant: Unit
    gravitationConstant: Unit
    gravity: Unit
    hartreeEnergy: Unit
    i: number
    IndexNode: IndexNodeCtor
    Infinity: number
    inverseConductanceQuantum: Unit
    isArray: (arg: any) => arg is any[]
    klitzing: Unit
    LN10: number
    LN2: number
    LOG10E: number
    LOG2E: number
    loschmidt: Unit
    magneticConstant: Unit
    magneticFluxQuantum: Unit
    Matrix: MatrixCtor
    molarMass: Unit
    molarMassC12: Unit
    molarPlanckConstant: Unit
    molarVolume: Unit
    NaN: number
    neutronMass: Unit
    Node: NodeCtor
    nuclearMagneton: Unit
    ObjectNode: ObjectNodeCtor
    OperatorNode: OperatorNodeCtor
    ParenthesisNode: ParenthesisNodeCtor

    Parse an expression. Returns a node tree, which can be evaluated by invoking node.evaluate();

    phi: number
    pi: number
    planckCharge: Unit
    planckConstant: Unit
    planckLength: Unit
    planckMass: Unit
    planckTemperature: Unit
    planckTime: Unit
    protonMass: Unit
    quantumOfCirculation: Unit
    RangeNode: RangeNodeCtor
    reducedPlanckConstant: Unit
    RelationalNode: RelationalNodeCtor
    rydberg: Unit
    sackurTetrode: Unit
    secondRadiation: Unit
    simplify: Simplify

    Simplify an expression tree.

    The expression to be simplified

    (optional) A list of rules are applied to an expression, repeating over the list until no further changes are made. It’s possible to pass a custom set of rules to the function as second argument. A rule can be specified as an object, string, or function.

    (optional) Scope to variables

    (optional) An object with simplify options

    Returns the simplified form of expr

    speedOfLight: Unit
    SQRT1_2: number
    SQRT2: number
    stefanBoltzmann: Unit
    SymbolNode: SymbolNodeCtor
    tau: number
    thomsonCrossSection: Unit
    typed: (
        name: string,
        signatures: Record<string, (...args: any[]) => any>,
    ) => (...args: any[]) => any

    Create a typed-function which checks the types of the arguments and can match them against multiple provided signatures. The typed-function automatically converts inputs in order to find a matching signature. Typed functions throw informative errors in case of wrong input arguments.

    Type Declaration

      • (
            name: string,
            signatures: Record<string, (...args: any[]) => any>,
        ): (...args: any[]) => any
      • Parameters

        • name: string

          Optional name for the typed-function

        • signatures: Record<string, (...args: any[]) => any>

          Object with one or multiple function signatures

        Returns (...args: any[]) => any

        The created typed-function.

    uninitialized: any

    If null were to be included in this interface, it would be auto-suggested as an import in VSCode. This causes issues because null is not a valid label.

    Unit: UnitCtor
    vacuumImpedance: Unit
    version: string
    weakMixingAngle: Unit
    wienDisplacement: Unit

    Methods

    • Calculate the absolute value of a number. For matrices, the function is evaluated element wise.

      Parameters

      • x: Complex

        A number or matrix for which to get the absolute value

      Returns number

      Absolute value of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the inverse cosine of a value.

      Parameters

      • x: number

        Function input

      Returns number | Complex

      The arc cosine of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the hyperbolic arccos of a value, defined as acosh(x) = ln(sqrt(x^2 - 1) + x).

      Parameters

      • x: number

        Function input

      Returns number | Complex

      The hyperbolic arccosine of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the inverse cotangent of a value.

      Parameters

      • x: number

        Function input

      Returns number

      The arc cotangent of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the inverse hyperbolic tangent of a value, defined as acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2.

      Parameters

      • x: number

        Function input

      Returns number

      The inverse hyperbolic tangent of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the inverse cosecant of a value.

      Parameters

      • x: number

        Function input

      Returns number | Complex

      The arc cosecant of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the inverse hyperbolic cosecant of a value, defined as acsch(x) = ln(1/x + sqrt(1/x^2 + 1)).

      Parameters

      • x: number

        Function input

      Returns number

      The inverse hyperbolic cosecant of x

    • Type Parameters

      Parameters

      Returns T

    • Add two values, x + y. For matrices, the function is evaluated element wise.

      Type Parameters

      Parameters

      • x: T

        First value to add

      • y: T

        Second value to add

      Returns T

      Sum of x and y

    • Type Parameters

      Parameters

      • x: T
      • y: T
      • ...values: T[]

      Returns T

    • Parameters

      Returns MathType

    • Parameters

      Returns MathType

    • Compute the argument of a complex value. For a complex number a + bi, the argument is computed as atan2(b, a). For matrices, the function is evaluated element wise.

      Parameters

      • x: number | Complex

        A complex number or array with complex numbers

      Returns number

      The argument of x

    • Parameters

      Returns BigNumber

    • Type Parameters

      Parameters

      Returns T

    • Calculate the inverse secant of a value.

      Parameters

      • x: number

        Function input

      Returns number | Complex

      The arc secant of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the hyperbolic arcsecant of a value, defined as asech(x) = ln(sqrt(1/x^2 - 1) + 1/x).

      Parameters

      • x: number

        Function input

      Returns number | Complex

      The hyperbolic arcsecant of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the inverse sine of a value.

      Parameters

      • x: number

        Function input

      Returns number | Complex

      The arc sine of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the hyperbolic arcsine of a value, defined as asinh(x) = ln(x + sqrt(x^2 + 1)).

      Type Parameters

      Parameters

      • x: T

        Function input

      Returns T

      The hyperbolic arcsine of x

    • Calculate the inverse tangent of a value.

      Type Parameters

      Parameters

      • x: T

        Function input

      Returns T

      The arc tangent of x

    • Calculate the inverse tangent function with two arguments, y/x. By providing two arguments, the right quadrant of the computed angle can be determined. For matrices, the function is evaluated element wise.

      Type Parameters

      Parameters

      • y: T
      • x: T

        Function input

      Returns T

      Four quadrant inverse tangent

    • Calculate the hyperbolic arctangent of a value, defined as atanh(x) = ln((1 + x)/(1 - x)) / 2.

      Parameters

      • x: number

        Function input

      Returns number | Complex

      The hyperbolic arctangent of x

    • Type Parameters

      Parameters

      Returns T

    • The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. bellNumbers only takes integer arguments. The following condition must be enforced: n

      = 0

      Type Parameters

      Parameters

      • n: T

        Total number of objects in the set

      Returns T

      B(n)

    • Compute the nth Bernoulli number

      Type Parameters

      Parameters

      • n: T

        index

      Returns NoLiteralType<T>

      nth Bernoulli number

    • Parameters

      • n: bigint

      Returns Fraction

    • Create a bigint, which can store integers with arbitrary precision. When a matrix is provided, all elements will be converted to bigint.

      Parameters

      • Optionalx: string | number | bigint | boolean | BigNumber | Fraction | null

        Value for the integer, 0 by default.

      Returns bigint

      The created bigint

    • Type Parameters

      Parameters

      Returns T

    • Create a BigNumber, which can store numbers with arbitrary precision. When a matrix is provided, all elements will be converted to BigNumber.

      Parameters

      • Optionalx: string | number | bigint | boolean | Unit | BigNumber | Fraction | null

        Value for the big number, 0 by default.

      Returns BigNumber

      The created bignumber

    • Type Parameters

      Parameters

      Returns T

    • Bitwise NOT value, ~x. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.

      Type Parameters

      Parameters

      • x: T

        Value to not

      Returns T

      NOT of x

    • Bitwise OR two values, x | y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the lowest print base.

      Type Parameters

      Parameters

      • x: T

        First value to or

      • y: T

        Second value to or

      Returns T

      OR of x and y

    • Create a boolean or convert a string or number to a boolean. In case of a number, true is returned for non-zero numbers, and false in case of zero. Strings can be 'true' or 'false', or can contain a number. When value is a matrix, all elements will be converted to boolean.

      Parameters

      • x: string | number | boolean | null

        A value of any type

      Returns boolean

      The boolean value

    • Parameters

      Returns MathCollection

    • The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0

      Type Parameters

      Parameters

      • n: T

        nth Catalan number

      Returns T

      Cn(n)

    • Calculate the cubic root of a value.

      Parameters

      • x: Complex

        Value for which to calculate the cubic root.

      • OptionalallRoots: boolean

        Optional, false by default. Only applicable when x is a number or complex number. If true, all complex roots are returned, if false (default) the principal root is returned.

      Returns Complex

      Returns the cubic root of x

    • Type Parameters

      Parameters

      Returns T

    • Wrap any value in a chain, allowing to perform chained operations on the value. All methods available in the math.js library can be called upon the chain, and then will be evaluated with the value itself as first argument. The chain can be closed by executing chain.done(), which returns the final value. The chain has a number of special functions: done() Finalize the chain and return the chain's value. valueOf() The same as done() toString() Executes math.format() onto the chain's value, returning a string representation of the value.

      Type Parameters

      • TValue

      Parameters

      • Optionalvalue: TValue

        A value of any type on which to start a chained operation.

      Returns MathJsChain<TValue>

      The created chain

    • Clone an object.

      Type Parameters

      • TType

      Parameters

      • x: TType

        Object to be cloned

      Returns TType

      A clone of object x

    • Return a column from a Matrix.

      Type Parameters

      Parameters

      • value: T

        An array or matrix

      • column: number

        The index of the column

      Returns T

      The retrieved column

    • Compute the number of ways of picking k unordered outcomes from n possibilities. Combinations only takes integer arguments. The following condition must be enforced: k <= n.

      Type Parameters

      Parameters

      • n: T

        Total number of objects in the set

      • k: number | BigNumber

        Number of objects in the subset

      Returns NoLiteralType<T>

      Number of possible combinations

    • Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y. x and y are considered equal when the relative difference between x and y is smaller than the configured relTol and absTol. The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise.

      Parameters

      • x: string | MathType

        First value to compare

      • y: string | MathType

        Second value to compare

      Returns number | BigNumber | Fraction | MathCollection<MathNumericType>

      Returns the result of the comparison: 1 when x > y, -1 when x < y, and 0 when x == y.

    • Compare two values of any type in a deterministic, natural way. For numeric values, the function works the same as math.compare. For types of values that can’t be compared mathematically, the function compares in a natural way.

      Parameters

      • x: any

        First value to compare

      • y: any

        Second value to compare

      Returns number

      Returns the result of the comparison: 1 when x > y, -1 when x < y, and 0 when x == y.

    • Parse and compile an expression. Returns a an object with a function evaluate([scope]) to evaluate the compiled expression.

      Parameters

      Returns EvalFunction

      An object with the compiled expression

    • Parameters

      Returns EvalFunction[]

      An array of objects with the compiled expressions

    • The composition counts of n into k parts. Composition only takes integer arguments. The following condition must be enforced: k <= n.

      Type Parameters

      Parameters

      • n: T

        Total number of objects in the set

      • k: number | BigNumber

        Number of objects in the subset

      Returns NoLiteralType<T>

      Returns the composition counts of n into k parts.

    • Calculate the correlation coefficient between two matrix.

      Parameters

      • x: MathCollection

        The first array or matrix to compute correlation coefficient

      • y: MathCollection

        The second array or matrix to compute correlation coefficient

      Returns MathType

      correlation coefficient

    • Calculate the cosine of a value.

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The cosine of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2

      • (exp(x) + exp(-x)).

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The hyperbolic cosine of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x).

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The cotangent of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1 / tanh(x).

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The hyperbolic cotangent of x

    • Type Parameters

      Parameters

      Returns T

    • Count the number of elements of a matrix, array or string.

      Parameters

      Returns number

      The number of members passed in parameters

    • Create a user-defined unit and register it with the Unit type.

      Parameters

      • name: string

        The name of the new unit. Must be unique. Example: ‘knot’

      • Optionaldefinition: string | Unit | UnitDefinition

        Definition of the unit in terms of existing units. For example, ‘0.514444444 m / s’.

      • Optionaloptions: CreateUnitOptions

        (optional) An object containing any of the following properties:
        - prefixes {string} “none”, “short”, “long”, “binary_short”, or “binary_long”. The default is “none”.
        - aliases {Array} Array of strings. Example: [‘knots’, ‘kt’, ‘kts’]
        - offset {Numeric} An offset to apply when converting from the unit. For example, the offset for celsius is 273.15. Default is 0.

      Returns Unit

      The new unit

    • Create a user-defined unit and register it with the Unit type.

      Parameters

      Returns Unit

      The new unit

    • Calculate the cross product for two vectors in three dimensional space. The cross product of A = [a1, a2, a3] and B =[b1, b2, b3] is defined as: cross(A, B) = [ a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1

      • b2 - a2 * b1 ]

      Parameters

      Returns MathCollection

      Returns the cross product of x and y

    • Calculate the cosecant of a value, defined as csc(x) = 1/sin(x).

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The cosecant hof x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1 / sinh(x).

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The hyperbolic cosecant of x

    • Type Parameters

      Parameters

      Returns T

    • Transpose and complex conjugate a matrix. All values of the matrix are reflected over its main diagonal and then the complex conjugate is taken. This is equivalent to complex conjugation for scalars and vectors.

      Parameters

      Returns MathCollection

    • Compute the cube of a value, x * x * x. For matrices, the function is evaluated element wise.

      Type Parameters

      Parameters

      • x: T

        Number for which to calculate the cube

      Returns T

      Cube of x

    • Compute the cumulative sum of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the cumulative sums along a specified dimension (defaulting to the first) will be calculated.

      Parameters

      • ...args: MathType[]

        A single matrix or multiple scalar values

      Returns MathType[]

      The cumulative sums of the the values.

    • Parameters

      • array: MathCollection

        A single matrix

      • Optionaldim: number

        The dimension along which to sum (defaults to 0)

      Returns MathCollection

      The cumulative sums along the given dimension

    • Test element wise whether two matrices are equal. The function accepts both matrices and scalar values.

      Parameters

      Returns MathType

      Returns true when the input matrices have the same size and each of their elements is equal.

    • Parameters

      • expr: string | MathNode

        The expression to differentiate

      • variable: string | MathNode

        The variable over which to differentiate

      • Optionaloptions: { simplify: boolean }

        There is one option available, simplify, which is true by default. When false, output will not be simplified.

      Returns MathNode

      The derivative of expr

    • Calculate the determinant of a matrix.

      Parameters

      Returns number

      the determinant of x

    • Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with vector x on the diagonal will be returned. When x is a two dimensional matrix, the matrixes kth diagonal will be returned as vector. When k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.

      Parameters

      • X: MathCollection

        A two dimensional matrix or a vector

      • Optionalformat: string

        The matrix storage format. Default value: 'dense'.

      Returns Matrix

      Diagonal matrix from input vector, or diagonal from input matrix

    • Parameters

      Returns MathCollection

    • Calculate the difference between adjacent elements of a matrix or array.

      Type Parameters

      Parameters

      • x: T

        A matrix or array

      • Optionaldim: number | BigNumber

        The dimension to apply the difference on.

      Returns T

      A matrix or array containing the differences

    • Calculates: The Euclidean distance between two points in 2 and 3 dimensional spaces. Distance between point and a line in 2 and 3 dimensional spaces. Pairwise distance between a set of 2D or 3D points NOTE: When substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c For parametric equation of a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, c)

      Parameters

      • x: object | MathCollection<MathNumericType>

        Coordinates of the first point

      • y: object | MathCollection<MathNumericType>

        Coordinates of the second point OR coefficients of a line in 3D OR first end-point of a line if the calculation is for distance between point and a line in 2D

      • Optionalz: object | MathCollection<MathNumericType>

        Coordinates of second end-point of a line if the calculation is for distance between point and a line in 2D

      Returns number | BigNumber

      Returns the distance from two/three points

    • Divide two values, x / y. To divide matrices, x is multiplied with the inverse of y: x * inv(y).

      Parameters

      Returns number | Unit

      Quotient, x / y

    • Parameters

      Returns Unit

    • Parameters

      • x: number
      • y: number

      Returns number

    • Parameters

      Returns MathType

    • Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as: dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn

      Parameters

      Returns number

      Returns the dot product of x and y

    • Calculates the power of x to y element wise.

      Type Parameters

      Parameters

      Returns T

      The value of x to the power y

    • Compute eigenvalues and eigenvectors of a matrix. The eigenvalues are sorted by their absolute value, ascending. An eigenvalue with multiplicity k will be listed k times. The eigenvectors are returned as an array of objects, each with a value and a vector. If the algorithm fails to converge, it will throw an error – in that case, however, you may still find useful information in err.values and err.vectors

      Parameters

      Returns {
          eigenvectors: { value: number | BigNumber; vector: MathCollection }[];
          values: MathCollection;
      }

      Object containing an array of eigenvalues and a matrix with eigenvectors as columns.

    • Parameters

      Returns { values: MathCollection }

    • Test whether two values are equal.

      The function tests whether the relative difference between x and y is smaller than the configured relTol and absTol. The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise. In case of complex numbers, x.re must equal y.re, and x.im must equal y.im. Values null and undefined are compared strictly, thus null is only equal to null and nothing else, and undefined is only equal to undefined and nothing else.

      Parameters

      • x: string | MathType

        First value to compare

      • y: string | MathType

        Second value to compare

      Returns boolean | MathCollection<MathNumericType>

      Returns true when the compared values are equal, else returns false

    • Evaluate an expression.

      Parameters

      Returns any

      The result of the expression

    • Parameters

      Returns any[]

    • Calculate the exponent of a value. For matrices, the function is evaluated element wise.

      Type Parameters

      Parameters

      • x: T

        A number or matrix to exponentiate

      Returns T

      Exponent of x

    • Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation. The exponential is calculated using the Padé approximant with scaling and squaring; see “Nineteen Dubious Ways to Compute the Exponential of a Matrix,” by Moler and Van Loan.

      Parameters

      Returns Matrix

      The exponential of x

    • Calculate the value of subtracting 1 from the exponential value. For matrices, the function is evaluated element wise.

      Type Parameters

      Parameters

      • x: T

        A number or matrix to apply expm1

      Returns T

      Exponent of x

    • Calculate N-dimensional Fourier transform

      Type Parameters

      Parameters

      • arr: T

        An array or matrix

      Returns T

      N-dimensional Fourier transformation of the array

    • Filter the items in an array or one dimensional matrix.

      Parameters

      • x: string[] | MathCollection<MathNumericType>

        A one dimensional matrix or array to filter

      • test:
            | RegExp
            | (
                (
                    value: any,
                    index: number[],
                    matrix: string[] | MathCollection<MathNumericType>,
                ) => boolean
            )

        A function or regular expression to test items. All entries for which test returns true are returned. When test is a function, it is invoked with three parameters: the value of the element, the index of the element, and the matrix/array being traversed. The function must return a boolean.

      Returns MathCollection

    • Flatten a multi dimensional matrix into a single dimensional matrix.

      Type Parameters

      Parameters

      • x: T

        Matrix to be flattened

      Returns T

      Returns the flattened matrix

    • Iterate over all elements of a matrix/array, and executes the given callback function.

      Type Parameters

      Parameters

      • x: T

        The matrix to iterate on.

      • callback: (value: any, index: number[], matrix: T) => void

        The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix/array being traversed.

      Returns void

    • Format a value of any type into a string.

      Parameters

      • value: any

        The value to be formatted

      • Optionaloptions: number | BigNumber | FormatOptions | ((item: any) => string)

        An object with formatting options.

      • Optionalcallback: (value: any) => string

        A custom formatting function, invoked for all numeric elements in value, for example all elements of a matrix, or the real and imaginary parts of a complex number. This callback can be used to override the built-in numeric notation with any type of formatting. Function callback is called with value as parameter and must return a string.

      Returns string

      The formatted value

    • Create a fraction convert a value to a fraction.

      Parameters

      Returns Fraction

      Returns a fraction

    • Parameters

      Returns MathCollection

    • Parameters

      • numerator: bigint

        Argument specifying the numerator of the fraction

      • denominator: bigint

        Argument specifying the denominator of the fraction

      Returns Fraction

      Returns a fraction

    • Parameters

      • numerator: number
      • denominator: number

      Returns Fraction

    • Calculates the frequency response of a filter given its numerator and denominator coefficients.

      Type Parameters

      Parameters

      • b: T

        The numerator polynomial of the filter

      • a: T

        The denominator polynomial of the filter

      • Optionalw: number | T

        The range of frequencies in which the response is to be calculated

      Returns { h: T; w: T }

      The frequency response

    • Compute the gamma function of a value using Lanczos approximation for small values, and an extended Stirling approximation for large values.

      Type Parameters

      Parameters

      • n: T

        A real or complex number

      Returns NoLiteralType<T>

      The gamma of n

    • Return the (name of the) data type of the elements of matrix, or 'mixed'.

      Parameters

      Returns string

      A string specifying the data type of the elements of m

    • Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.

      Parameters

      • x: any

        Value to be tested

      Returns boolean | boolean[]

      Returns true when x is a number, BigNumber, bigint, Fraction, Boolean, or a String containing number. Returns false for other types. Throws an error in case of unknown types.

    • Retrieve help on a function or data type. Help files are retrieved from the documentation in math.expression.docs.

      Parameters

      • search: () => any

        A function or function name for which to get help

      Returns Help

      A help object

    • Calculate the hypotenuse of a list with values. The hypotenuse is defined as: hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...) For matrix input, the hypotenuse is calculated for all values in the matrix.

      Type Parameters

      Parameters

      • ...args: T[]

        A list with numeric values or an Array or Matrix. Matrix and Array input is flattened and returns a single number for the whole matrix.

      Returns T

      Returns the hypotenuse of the input values.

    • Type Parameters

      Parameters

      • args: T[]

      Returns T

    • Create a 2-dimensional identity matrix with size m x n or n x n. The matrix has ones on the diagonal and zeros elsewhere.

      Parameters

      Returns number | MathCollection<MathNumericType>

      A matrix with ones on the diagonal

    • Parameters

      • m: number

        The x dimension for the matrix

      • n: number

        The y dimension for the matrix

      • Optionalformat: string

        The Matrix storage format

      Returns number | MathCollection<MathNumericType>

      A matrix with ones on the diagonal

    • Calculate N-dimensional inverse Fourier transform

      Type Parameters

      Parameters

      • arr: T

        An array or matrix

      Returns T

      N-dimensional Fourier transformation of the array

    • Import functions from an object or a module To avoid errors when using one of the imported functions extend module like this:

      Parameters

      Returns void

      // imported_math_functions.ts
      declare module 'mathjs' {
      interface MathJsInterface {
      hello(a: number): number;
      }
      }
    • Create an index. An Index can store ranges having start, step, and end for multiple dimensions. Matrix.get, Matrix.set, and math.subset accept an Index as input.

      Parameters

      • ...ranges: any[]

        Zero or more ranges or numbers.

      Returns Index

      Returns the created index

    • Calculates the point of intersection of two lines in two or three dimensions and of a line and a plane in three dimensions. The inputs are in the form of arrays or 1 dimensional matrices. The line intersection functions return null if the lines do not meet. Note: Fill the plane coefficients as x + y + z = c and not as x + y + z + c = 0.

      Parameters

      • w: MathCollection

        Co-ordinates of first end-point of first line

      • x: MathCollection

        Co-ordinates of second end-point of first line

      • y: MathCollection

        Co-ordinates of first end-point of second line OR Coefficients of the plane's equation

      • Optionalz: MathCollection<MathNumericType>

        Co-ordinates of second end-point of second line OR null if the calculation is for line and plane

      Returns MathArray

      Returns the point of intersection of lines/lines-planes

    • Parameters

      • x: unknown

      Returns x is ArrayNode<MathNode[]>

    • Parameters

      • x: unknown

      Returns x is bigint

    • Parameters

      • x: unknown

      Returns x is BigNumber

    • Parameters

      • x: unknown

      Returns x is BlockNode<MathNode>

    • Parameters

      • x: unknown

      Returns x is boolean

    • Test whether a value is bounded

      Parameters

      Returns boolean

      Boolean true when x represents a bounded mathematical entity

    • Parameters

      • x: unknown

      Returns x is MathJsChain<unknown>

    • Parameters

      • x: unknown

      Returns x is any[] | Matrix<MathNumericType>

    • Parameters

      • x: unknown

      Returns x is Complex

    • Parameters

      • x: unknown

      Returns x is ConstantNode<number>

    • Parameters

      • x: unknown

      Returns x is Date

    • Test whether a value is finite, elementwise on collections

      Parameters

      Returns boolean

      Boolean | MathCollection

    • Parameters

      Returns MathCollection

    • Parameters

      • x: unknown

      Returns x is Fraction

    • Parameters

      • x: unknown

      Returns boolean

    • Parameters

      • x: unknown

      Returns x is Help

    • Parameters

      • x: unknown

      Returns x is Index

    • Parameters

      • x: unknown

      Returns x is IndexNode<MathNode[]>

    • Test whether a value is an integer number. The function supports number, BigNumber, and Fraction. The function is evaluated element-wise in case of Array or Matrix input.

      Parameters

      Returns boolean

      Returns true when x contains a numeric, integer value. Throws an error in case of an unknown data type.

    • Type Parameters

      • T
      • U

      Parameters

      • x: unknown

      Returns x is Map<T, U>

    • Test whether a value is NaN (not a number). The function supports types number, BigNumber, Fraction, Unit and Complex. The function is evaluated element-wise in case of Array or Matrix input.

      Parameters

      Returns boolean

      Returns true when x is NaN. Throws an error in case of an unknown data type.

    • Test whether a value is negative: smaller than zero. The function supports types number, BigNumber, Fraction, and Unit. The function is evaluated element-wise in case of Array or Matrix input.

      Parameters

      Returns boolean

      Returns true when x is larger than zero. Throws an error in case of an unknown data type.

    • Parameters

      • x: unknown

      Returns x is MathNode

    • Parameters

      • x: unknown

      Returns x is null


    • Utils


      Parameters

      • x: unknown

      Returns x is number

    • Test whether a value is an numeric value. The function is evaluated element-wise in case of Array or Matrix input.

      Parameters

      • x: any

        Value to be tested

      Returns x is number | bigint | boolean | BigNumber | Fraction

      Returns true when x is a number, BigNumber, bigint, Fraction, or boolean. Returns false for other types. Throws an error in case of unknown types.

    • Parameters

      • x: unknown

      Returns boolean

    • Type Parameters

      • T extends string | number | symbol
      • U

      Parameters

      • x: unknown

      Returns x is ObjectWrappingMap<T, U>

    • Type Parameters

      • T
      • U

      Parameters

      • x: unknown

      Returns x is PartitionedMap<T, U>

    • Test whether a value is positive: larger than zero. The function supports types number, BigNumber, Fraction, and Unit. The function is evaluated element-wise in case of Array or Matrix input.

      Parameters

      Returns boolean

      Returns true when x is larger than zero. Throws an error in case of an unknown data type.

    • Test whether a value is prime: has no divisors other than itself and one. The function supports type number, bignumber. The function is evaluated element-wise in case of Array or Matrix input.

      Parameters

      Returns boolean

      Returns true when x is larger than zero. Throws an error in case of an unknown data type.

    • Parameters

      • x: unknown

      Returns boolean

    • Parameters

      • x: unknown

      Returns x is RegExp

    • Parameters

      • x: unknown

      Returns x is ResultSet

    • Parameters

      • x: unknown

      Returns x is string

    • Parameters

      • x: unknown

      Returns x is SymbolNode

    • Parameters

      • x: unknown

      Returns x is undefined

    • Parameters

      • x: unknown

      Returns x is Unit

    • Test whether a value is zero. The function can check for zero for types number, BigNumber, Fraction, Complex, and Unit. The function is evaluated element-wise in case of Array or Matrix input.

      Parameters

      Returns boolean

      Returns true when x is zero. Throws an error in case of an unknown data type.

    • Calculate the Kullback-Leibler (KL) divergence between two distributions

      Parameters

      Returns number

      Returns distance between q and p

    • Test whether value x is larger than y. The function returns true when x is larger than y and the relative difference between x and y is larger than the configured relTol and absTol. The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise.

      Parameters

      • x: string | MathType

        First value to compare

      • y: string | MathType

        Second value to compare

      Returns boolean | MathCollection<MathNumericType>

      Returns true when x is larger than y, else returns false

    • Test whether value x is larger or equal to y. The function returns true when x is larger than y or the relative difference between x and y is smaller than the configured relTol and absTol. The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise.

      Parameters

      • x: string | MathType

        First value to compare

      • y: string | MathType

        Second value to compare

      Returns boolean | MathCollection<MathNumericType>

      Returns true when x is larger than or equal to y, else returns false

    • Calculate the least common multiple for two or more values or arrays. lcm is defined as: lcm(a, b) = abs(a * b) / gcd(a, b) For matrices, the function is evaluated element wise.

      Type Parameters

      Parameters

      • a: T

        An integer number

      • b: T

        An integer number

      Returns T

      The least common multiple

    • Gives the number of “leaf nodes” in the parse tree of the given expression. A leaf node is one that has no subexpressions, essentially either a symbol or a constant. Note that 5! has just one leaf, the 5; the unary factorial operator does not add a leaf. On the other hand, function symbols do add leaves, so sin(x)/cos(x) has four leaves.

      Parameters

      Returns number

    • Bitwise left logical shift of a value x by y number of bits, x << y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.

      Type Parameters

      Parameters

      • x: T

        Value to be shifted

      • y: number | bigint | BigNumber

        Amount of shifts

      Returns NoLiteralType<T>

      x shifted left y times

    • Compute the log gamma function of a value, using Lanczos approximation for numbers and Stirling series for complex numbers.

      Type Parameters

      Parameters

      • n: T

        A real or complex number

      Returns NoLiteralType<T>

      The log gamma of n

    • Calculate the logarithm of a value.

      Type Parameters

      Parameters

      • x: T

        Value for which to calculate the logarithm.

      • Optionalbase: number | BigNumber | Complex

        Optional base for the logarithm. If not provided, the natural logarithm of x is calculated. Default value: e.

      Returns NoLiteralType<T>

      Returns the logarithm of x

    • Calculate the 10-base of a value. This is the same as calculating log(x, 10). For matrices, the function is evaluated element wise.

      Type Parameters

      Parameters

      • x: T

        Value for which to calculate the logarithm.

      Returns T

      Returns the 10-base logarithm of x

    • Calculate the 2-base of a value. This is the same as calculating log(x, 2). For matrices, the function is evaluated element wise.

      Type Parameters

      Parameters

      • x: T

        Value for which to calculate the logarithm.

      Returns T

      Returns the 2-base logarithm of x

    • Solves the linear equation system by forwards substitution. Matrix must be a lower triangular matrix.

      Parameters

      Returns Matrix

      A column vector with the linear system solution (x)

    • Parameters

      Returns MathArray

    • Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in two matrices (L, U) and a row permutation vector p where A[p,:] = L * U

      Parameters

      Returns LUDecomposition

      The lower triangular matrix, the upper triangular matrix and the permutation matrix.

    • Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.

      Parameters

      • A: Matrix

        Invertible Matrix or the Matrix LU decomposition

      • b: MathCollection

        Column Vector

      • Optionalorder: number

        The Symbolic Ordering and Analysis order, see slu for details. Matrix must be a SparseMatrix

      • Optionalthreshold: number

        Partial pivoting threshold (1 for partial pivoting), see slu for details. Matrix must be a SparseMatrix.

      Returns Matrix

      Column vector with the solution to the linear system A * x = b

    • Parameters

      Returns MathArray

    • Returns Matrix

    • Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.

      Parameters

      Returns any

      The median absolute deviation

    • Iterate over all elements of a matrix/array, and executes the given callback function.

      Type Parameters

      Parameters

      • x: T

        The matrix to iterate on.

      • callback: (value: any, index: number[], matrix: T) => string | MathType

        The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix/array being traversed.

      Returns T

      Transformed map of x

    • Iterate over all elements of multiple matrices/arrays, and executes the given callback function.

      Type Parameters

      Parameters

      • x: T

        The first matrix to iterate on.

      • ...args: (T | ((value: any, ...args: any[]) => string | MathType))[]

        The rest of the matrices and at the end the callback function is invoked with multiple parameters: the values of the elements, the indices of the elements, and the matrices/arrays being traversed.

      Returns T

      Transformed map of matrices

    • Apply a function that maps an array to a scalar along a given axis of a matrix or array. Returns a new matrix or array with one less dimension than the input.

      Type Parameters

      Parameters

      • array: T

        The input Matrix

      • dim: number

        The dimension along which the callback is applied

      • callback: (array: MathCollection) => number

        The callback function that is applied. This Function should take an array or 1-d matrix as an input and return a number.

      Returns T

      The residual matrix with the function applied over some dimension.

    • Create a dense matrix from vectors as individual columns. If you pass row vectors, they will be transposed (but not conjugated!)

      Parameters

      Returns Matrix

    • Type Parameters

      Parameters

      Returns T[][]

    • Create a dense matrix from vectors as individual rows. If you pass column vectors, they will be transposed (but not conjugated!)

      Parameters

      Returns Matrix

    • Type Parameters

      Parameters

      Returns T[][]

    • Compute the maximum value of a matrix or a list with values. In case of a multi dimensional array, the maximum of the flattened array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based.

      Type Parameters

      Parameters

      • ...args: T[]

        Multiple scalar values

      Returns T

      The maximum value

    • Parameters

      Returns MathScalarType

      The maximum value

    • Type Parameters

      Parameters

      • A: T[] | T[][]

        A single matrix

      • Optionaldimension: number | BigNumber

        The maximum over the selected dimension

      Returns T

      The maximum value

    • Parameters

      Returns MathScalarType

      The maximum value

    • Compute the mean value of matrix or a list with values. In case of a multi dimensional array, the mean of the flattened array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based.

      Type Parameters

      Parameters

      • ...args: T[]

        Multiple scalar values

      Returns T

      The mean of all values

    • Parameters

      Returns MathScalarType

      The mean value

    • Type Parameters

      Parameters

      • A: T[] | T[][]

        A single matrix

      • Optionaldimension: number | BigNumber

        The mean over the selected dimension

      Returns T

      The mean value

    • Parameters

      Returns MathScalarType

      The mean value

    • Compute the median of a matrix or a list with values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned. Supported types of values are: Number, BigNumber, Unit In case of a (multi dimensional) array or matrix, the median of all elements will be calculated.

      Type Parameters

      Parameters

      • ...args: T[]

        Multiple scalar values

      Returns T

      The median value

    • Parameters

      Returns MathScalarType

      The median value

    • Type Parameters

      Parameters

      • A: T[] | T[][]

        A single matrix

      Returns T

      The median value

    • Parameters

      Returns MathScalarType

      The median value

    • Compute the minimum value of a matrix or a list of values. In case of a multi dimensional array, the minimum of the flattened array will be calculated. When dim is provided, the minimum over the selected dimension will be calculated. Parameter dim is zero-based.

      Type Parameters

      Parameters

      • ...args: T[]

        multiple scalar values

      Returns T

      The minimum value

    • Parameters

      Returns MathScalarType

      The minimum value

    • Type Parameters

      Parameters

      • A: T[] | T[][]

        A single matrix

      • Optionaldimension: number | BigNumber

        The minimum over the selected dimension

      Returns T

      The minimum value

    • Parameters

      Returns MathScalarType

      The minimum value

    • Computes the mode of a set of numbers or a list with values(numbers or characters). If there are more than one modes, it returns a list of those values.

      Type Parameters

      Parameters

      • ...args: T[]

        Multiple scalar values

      Returns T[]

      The mode of all values

    • Parameters

      Returns MathScalarType[]

      The mode of all values

    • Type Parameters

      Parameters

      • A: T[] | T[][]

        A single matrix

      Returns T[]

      The mode value

    • Parameters

      Returns MathScalarType[]

      The mode of all values

    • Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from n possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai <= 0

      Type Parameters

      Parameters

      • a: T[]

        Integer number of objects in the subset

      Returns NoLiteralType<T>

      multinomial coefficient

    • Calculate the norm of a number, vector or matrix. The second parameter p is optional. If not provided, it defaults to 2.

      Parameters

      • x: number | BigNumber | Complex | MathCollection<MathNumericType>

        Value for which to calculate the norm

      • Optionalp: string | number | BigNumber

        Vector space. Supported numbers include Infinity and -Infinity. Supported strings are: 'inf', '-inf', and 'fro' (The Frobenius norm) Default value: 2.

      Returns number | BigNumber

      the p-norm

    • Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation x^root = A For matrices, the function is evaluated element wise.

      Parameters

      • a: number | BigNumber | Complex

        Value for which to calculate the nth root

      • Optionalroot: number | BigNumber

        The root. Default value: 2.

      Returns number | Complex

      The nth root of a

    • Parameters

      Returns MathCollection

    • Calculate all nth roots of a value.

      Parameters

      • a: number | BigNumber | Complex

        Value for which to calculate the nth roots

      • Optionaln: number

        Which roots. Default value: 2.

      Returns Complex[]

      An array of Complex numbers giving the n nth roots of a

    • Create a number or convert a string, boolean, or unit to a number. When value is a matrix, all elements will be converted to number.

      Parameters

      • Optionalvalue: string | number | bigint | boolean | Unit | BigNumber | Fraction | null

        Value to be converted

      Returns number

      The created number

    • Parameters

      Returns number | MathCollection<MathNumericType>

    • Parameters

      • unit: Unit
      • valuelessUnit: string | Unit

        A valueless unit, used to convert a unit to a number

      Returns number

      The created number

    • Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.

      Parameters

      • value: string | number | bigint | BigNumber | Fraction

        The value to be converted

      • outputType: "number"

        The desired numeric output type

      Returns number

    • Parameters

      Returns BigNumber

    • Parameters

      Returns bigint

    • Parameters

      Returns Fraction

    • Create a matrix filled with ones. The created matrix can have one or multiple dimensions.

      Parameters

      • Optionalsize: number | number[] | BigNumber | BigNumber[]

        The size of each dimension of the matrix

      • Optionalformat: string

        The matrix storage format

      Returns MathCollection

      A matrix filled with ones

    • Parameters

      • m: number | BigNumber

        The x dimension of the matrix

      • n: number | BigNumber

        The y dimension of the matrix

      • Optionalformat: string

        The matrix storage format

      Returns MathCollection

      A matrix filled with ones

    • Parameters

      • m: number | BigNumber

        The x dimension of the matrix

      • n: number | BigNumber

        The y dimension of the matrix

      • p: number | BigNumber

        The z dimension of the matrix

      • Optionalformat: string

        The matrix storage format

      Returns MathCollection

      A matrix filled with ones

    • Create a parser. The function creates a new math.expression.Parser object.

      Returns Parser

      A Parser object

    • Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.

      Parameters

      • x: MathCollection

        A one dimensional matrix or array to sort

      • k: number

        The kth smallest value to be retrieved; zero-based index

      • Optionalcompare: "desc" | "asc" | ((a: any, b: any) => number)

        An optional comparator function. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'.

      Returns any

      Returns the kth lowest value.

    • Compute the number of ways of obtaining an ordered subset of k elements from a set of n elements. Permutations only takes integer arguments. The following condition must be enforced: k <= n.

      Type Parameters

      Parameters

      • n: T

        The number of objects in total

      • Optionalk: number | BigNumber

        The number of objects in the subset

      Returns NoLiteralType<T>

      The number of permutations

    • Random pick a value from a one dimensional array. Array element is picked using a random function with uniform distribution.

      Type Parameters

      • T

      Parameters

      • array: T[]

        A one dimensional array

      Returns T

      Returns a single random value from array when number is undefined. Returns an array with the configured number of elements when number is defined.

    • Type Parameters

      • T

      Parameters

      • array: T[]
      • number: number

      Returns T[]

    • Type Parameters

      • T

      Parameters

      • array: T[]
      • number: number
      • weights: number[]

      Returns T[]

    • Calculate the Moore–Penrose inverse of a matrix.

      Type Parameters

      Parameters

      • x: T

        Matrix to be inverted

      Returns T

      The inverse of x.

    • Parameters

      Returns (number | Complex)[]

    • Calculates the power of x to y, x ^ y. Matrix exponentiation is supported for square matrices x, and positive integer exponents y.

      Parameters

      Returns MathType

      x to the power y

    • Interpolate values into a string template.

      Parameters

      • template: string

        A string containing variable placeholders.

      • values: any

        An object containing variables which will be filled in in the template.

      • Optionalprecision: number

        Number of digits to format numbers. If not provided, the value will not be rounded.

      • Optionaloptions: number | object

        Formatting options, or the number of digits to format numbers. See function math.format for a description of all options.

      Returns void

      Interpolated string

    • Compute the product of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated.

      Type Parameters

      Parameters

      • ...args: T[]

        Multiple scalar values

      Returns T

      The product of all values

    • Parameters

      Returns MathScalarType

      The product of all values

    • Type Parameters

      Parameters

      • A: T[] | T[][]

        A single matrix

      Returns T

      The product of all values

    • Parameters

      Returns MathScalarType

      The product of all values

    • Calculate the Matrix QR decomposition. Matrix A is decomposed in two matrices (Q, R) where Q is an orthogonal matrix and R is an upper triangular matrix.

      Parameters

      • A: MathCollection

        A two dimensional matrix or array for which to get the QR decomposition.

      Returns QRDecomposition

      Q: the orthogonal matrix and R: the upper triangular matrix

    • Type Parameters

      Parameters

      • A: T[] | T[][]

        A single matrix

      • prob: number | BigNumber
      • Optionalsorted: boolean

        =false is data sorted in ascending order

      Returns T

      Quantile(s)

    • Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.

      Parameters

      Returns MathArray<MathNumericType> | MathScalarType

      Quantile(s)

    • Return a random number larger or equal to min and smaller than max using a uniform distribution.

      Parameters

      • Optionalmin: number

        Minimum boundary for the random value, included

      • Optionalmax: number

        Maximum boundary for the random value, excluded

      Returns number

      A random number

    • Type Parameters

      Parameters

      • size: T
      • Optionalmin: number
      • Optionalmax: number

      Returns T

    • Return a random integer number larger or equal to min and smaller than max using a uniform distribution.

      Parameters

      • min: number

        Minimum boundary for the random value, included

      • Optionalmax: number

        Maximum boundary for the random value, excluded

      Returns number

      A random number

    • Type Parameters

      Parameters

      • size: T
      • Optionalmin: number
      • Optionalmax: number

      Returns T

    • Create an array from a range. By default, the range end is excluded. This can be customized by providing an extra parameter includeEnd.

      Parameters

      • str: string

        A string 'start:end' or 'start:step:end'

      • OptionalincludeEnd: boolean

      Returns Matrix

      Parameters describing the ranges start, end, and optional step.

    • Parameters

      Returns Matrix

    • Parameters

      Returns Matrix

    • Parameters

      • expr: string | MathNode
      • Optionaloptional: boolean | object
      • Optionaldetailed: false

      Returns MathNode

    • Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.

      Parameters

      • expr: string | MathNode

        The expression to check if is a polynomial expression

      • Optionaloptional: boolean | object

        scope of expression or true for already evaluated rational expression at input

      • Optionaldetailed: true

        optional True if return an object, false if return expression node (default)

      Returns { coefficients: MathType[]; expression: string | MathNode; variables: string[] }

      The rational polynomial of expr

    • Returns replacer function that can be used as replacer in JSON.stringify function.

      Returns (key: any, value: any) => any

    • Reshape a multi dimensional array to fit the specified dimensions

      Type Parameters

      Parameters

      • x: T

        Matrix to be reshaped

      • sizes: number[]

        One dimensional array with integral sizes for each dimension

      Returns T

      A reshaped clone of matrix x

    • Resize a matrix

      Type Parameters

      Parameters

      • x: T

        Matrix to be resized

      • size: MathCollection

        One dimensional array with numbers

      • OptionaldefaultValue: string | number

        Zero by default, except in case of a string, in that case defaultValue = ' ' Default value: 0.

      Returns T

      A resized clone of matrix x

    • Replaces variable nodes with their scoped values

      Parameters

      • node: string | MathNode

        Tree to replace variable nodes in

      • Optionalscope: MathScope<any>

        Scope to read/write variables

      Returns MathNode

    • Parameters

      Returns MathNode[]

    • Parameters

      Returns Matrix

    • Returns reviver function that can be used as reviver in JSON.parse function.

      Returns (key: any, value: any) => any

    • Bitwise right arithmetic shift of a value x by y number of bits, x >> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.

      Type Parameters

      Parameters

      • x: T

        Value to be shifted

      • y: number | bigint | BigNumber

        Amount of shifts

      Returns NoLiteralType<T>

      x sign-filled shifted right y times

    • Bitwise right logical shift of value x by y number of bits, x >>> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.

      Type Parameters

      Parameters

      • x: T

        Value to be shifted

      • y: number

        Amount of shifts

      Returns NoLiteralType<T>

      x zero-filled shifted right y times

    • Return a Rotation Matrix for a given angle in radians

      Type Parameters

      Parameters

      • Optionaltheta: number | Unit | BigNumber | Complex

        Rotation angle

      • Optionalaxis: T
      • Optionalformat: "sparse" | "dense"

        Result Matrix storage format. Default value: 'dense'.

      Returns T

      Rotation Matrix

    • Return a row from a Matrix.

      Type Parameters

      Parameters

      • value: T

        An array or matrix

      • row: number

        The index of the row

      Returns T

      The retrieved row

    • Calculate the secant of a value, defined as sec(x) = 1/cos(x).

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The secant of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the hyperbolic secant of a value, defined as sech(x) = 1 / cosh(x).

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The hyperbolic secant of x

    • Type Parameters

      Parameters

      Returns T

    • Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.

      Type Parameters

      Parameters

      Returns T

      The cartesian product of two (multi)sets

    • Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation

      Type Parameters

      Parameters

      Returns T

      The difference of two (multi)sets

    • Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.

      Type Parameters

      Parameters

      • a: T

        A multiset

      Returns T

      A set containing the distinct elements of the multiset

    • Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.

      Type Parameters

      Parameters

      Returns T

      The intersection of two (multi)sets

    • Check whether a (multi)set is a subset of another (multi)set. (Every element of set1 is the element of set2.) Multi-dimension arrays will be converted to single-dimension arrays before the operation.

      Parameters

      Returns boolean

      True if a1 is subset of a2, else false

    • Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.

      Parameters

      Returns number

      The number of how many times the multiset contains the element

    • Create the powerset of a (multi)set. (The powerset contains very possible subsets of a (multi)set.) A multi-dimension array will be converted to a single-dimension array before the operation.

      Type Parameters

      Parameters

      • a: T

        A multiset

      Returns T

      The powerset of the (multi)set

    • Count the number of elements of a (multi)set. When a second parameter is ‘true’, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.

      Parameters

      Returns number

      The number of elements of the (multi)set

    • Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.

      Type Parameters

      Parameters

      Returns T

      The symmetric difference of two (multi)sets

    • Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.

      Type Parameters

      Parameters

      Returns T

      The union of two (multi)sets

    • Compute the sign of a value. The sign of a value x is: 1 when x > 1 -1 when x < 0 0 when x == 0 For matrices, the function is evaluated element wise.

      Type Parameters

      Parameters

      • x: T

        The number for which to determine the sign

      Returns T

      The sign of x

    • Calculate the sine of a value.

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The sine of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 * (exp(x) - exp(-x)).

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The hyperbolic sine of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U

      Parameters

      • A: Matrix

        A two dimensional sparse matrix for which to get the LU decomposition.

      • order: number

        The Symbolic Ordering and Analysis order: 0 - Natural ordering, no permutation vector q is returned 1 - Matrix must be square, symbolic ordering and analysis is performed on M = A + A' 2 - Symbolic ordering and analysis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'. This is appropriate for LU factorization of non-symmetric matrices. 3 - Symbolic ordering and analysis is performed on M = A' * A. This is best used for LU factorization is matrix M has no dense rows. A dense row is a row with more than 10*sqr(columns) entries.

      • threshold: number

        Partial pivoting threshold (1 for partial pivoting)

      Returns SLUDecomposition

      The lower triangular matrix, the upper triangular matrix and the permutation vectors.

    • Test whether value x is smaller than y. The function returns true when x is smaller than y and the relative difference between x and y is smaller than the configured relTol and absTol. The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise.

      Parameters

      • x: string | MathType

        First value to compare

      • y: string | MathType

        Second value to compare

      Returns boolean | MathCollection<MathNumericType>

      Returns true when x is smaller than y, else returns false

    • Test whether value x is smaller or equal to y. The function returns true when x is smaller than y or the relative difference between x and y is smaller than the configured relTol and absTol. The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise.

      Parameters

      • x: string | MathType

        First value to compare

      • y: string | MathType

        Second value to compare

      Returns boolean | MathCollection<MathNumericType>

      Returns true when x is smaller than or equal to y, else returns false

    • Sort the items in a matrix

      Type Parameters

      Parameters

      • x: T

        A one dimensional matrix or array to sort

      • compare: "desc" | "asc" | ((a: any, b: any) => number) | "natural"

        An optional _comparator function or name. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: ‘asc’

      Returns T

      Returns the sorted matrix

    • Create a Sparse Matrix. The function creates a new math.type.Matrix object from an Array. A Matrix has utility functions to manipulate the data in the matrix, like getting the size and getting or setting values in the matrix.

      Parameters

      Returns Matrix

      The created matrix

    • Split a unit in an array of units whose sum is equal to the original unit.

      Parameters

      • unit: Unit

        A unit to be split

      • parts: Unit[]

        An array of strings or valueless units

      Returns Unit[]

      An array of units

    • Calculate the square root of a value. For matrices, use either sqrtm for the matrix square root, or map(M, sqrt) to take the square root element wise.

      Parameters

      • x: number

        Value for which to calculate the square root

      Returns number | Complex

      Returns the square root of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the principal square root of a square matrix. The principal square root matrix X of another matrix A is such that X * X = A.

      Type Parameters

      Parameters

      • A: T

        The square matrix A

      Returns T

      The principal square root of matrix A

    • Compute the square of a value, x * x.

      Type Parameters

      Parameters

      • x: T

        Number for which to calculate the square

      Returns T

      Squared value

    • Squeeze a matrix, remove inner and outer singleton dimensions from a matrix.

      Type Parameters

      Parameters

      • x: T

        Matrix to be squeezed

      Returns T

      Squeezed matrix

    • Compute the standard deviation of a matrix or a list with values. The standard deviations is defined as the square root of the variance: std(A) = sqrt(variance(A)). In case of a (multi dimensional) array or matrix, the standard deviation over all elements will be calculated. Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following values: 'unbiased' (default) The sum of squared errors is divided by (n - 1) 'uncorrected' The sum of squared errors is divided by n 'biased' The sum of squared errors is divided by (n + 1)

      Type Parameters

      Parameters

      • ...args: T[]

        variadic argument of number to calculate standard deviation

      Returns T

      The standard deviation

    • Parameters

      Returns MathScalarType

      The standard deviation

    • Compute the standard deviation of a matrix or a list with values. The standard deviations is defined as the square root of the variance: std(A) = sqrt(variance(A)). In case of a (multi dimensional) array or matrix, the standard deviation over all elements will be calculated. Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following values: 'unbiased' (default) The sum of squared errors is divided by (n - 1) 'uncorrected' The sum of squared errors is divided by n 'biased' The sum of squared errors is divided by (n + 1)

      Parameters

      • array: MathCollection

        A single matrix to compute standard deviation.

      • Optionaldimension: number

        A dimension to calculate standard deviation

      • Optionalnormalization: "unbiased" | "uncorrected" | "biased"

        Determines how to normalize the variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value: ‘unbiased’.

      Returns MathNumericType[]

      The standard deviation array

    • Compute the standard deviation of a matrix or a list with values. The standard deviations is defined as the square root of the variance: std(A) = sqrt(variance(A)). In case of a (multi dimensional) array or matrix, the standard deviation over all elements will be calculated. Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following values: 'unbiased' (default) The sum of squared errors is divided by (n - 1) 'uncorrected' The sum of squared errors is divided by n 'biased' The sum of squared errors is divided by (n + 1)

      Parameters

      • array: MathCollection

        A single matrix or multiple scalar values

      • normalization: "unbiased" | "uncorrected" | "biased"

        Determines how to normalize the variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value: ‘unbiased’.

      Returns MathNumericType

      The standard deviation

    • The Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. stirlingS2 only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1

      Type Parameters

      Parameters

      • n: T

        Total number of objects in the set

      • k: number | BigNumber

        Number of objects in the subset

      Returns NoLiteralType<T>

      S(n,k)

    • Create a string or convert any object into a string. Elements of Arrays and Matrices are processed element wise.

      Parameters

      Returns string

      The created string

    • Parameters

      Returns MathCollection

    • Get or set a subset of a matrix or string.

      Type Parameters

      Parameters

      • value: T

        An array, matrix, or string

      • index: Index

        For each dimension, an index or list of indices to get or set.

      • Optionalreplacement: any

        An array, matrix, or scalar. If provided, the subset is replaced with replacement. If not provided, the subset is returned

      • OptionaldefaultValue: any

        Default value, filled in on new entries when the matrix is resized. If not provided, math.matrix elements will be left undefined. Default value: undefined.

      Returns T

      Either the retrieved subset or the updated matrix

    • Subtract two values, x - y. For matrices, the function is evaluated element wise.

      Type Parameters

      Parameters

      • x: T

        Initial value

      • y: T

        Value to subtract from x

      Returns T

      Subtraction of x and y

    • Parameters

      Returns MathType

    • Compute the sum of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated.

      Type Parameters

      Parameters

      • ...args: T[]

        A single matrix or multiple scalar values

      Returns T

      The sum of all values

    • Parameters

      Returns MathScalarType

      The sum of all values

    • Type Parameters

      Parameters

      • A: T[] | T[][]

        A single matrix

      • Optionaldimension: number | BigNumber

        The sum over the selected dimension

      Returns T

      The sum of all values

    • Parameters

      Returns MathScalarType

      The sum of all values

    • Determines if two expressions are symbolically equal, i.e. one is the result of valid algebraic manipulations on the other.

      Parameters

      • expr1: MathNode

        The first expression to compare

      • expr2: MathNode

        The second expression to compare

      • Optionaloptions: SimplifyOptions

        Optional option object, passed to simplify

      Returns boolean

      Returns true if a valid manipulation making the expressions equal is found.

    • Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x).

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The tangent of x

    • Type Parameters

      Parameters

      Returns T

    • Calculate the hyperbolic tangent of a value, defined as tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1).

      Parameters

      • x: number | Unit

        Function input

      Returns number

      The hyperbolic tangent of x

    • Type Parameters

      Parameters

      Returns T

    • Converts a unit to the most appropriate display unit. When no preferred units are provided, the function automatically find the best prefix. When preferred units are provided, it converts to the unit that gives a value closest to 1.

      Returns Unit

      Unit with optimized prefix/unit

    • Parameters

      • units: string[] | Unit[]
      • options: object

      Returns Unit

    • Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.

      Parameters

      Returns number

      The trace of x

    • Transpose a matrix. All values of the matrix are reflected over its main diagonal. Only two dimensional matrices are supported.

      Type Parameters

      Parameters

      • x: T

        Matrix to be transposed

      Returns T

      The transposed matrix

    • Determine the type of a variable.

      Parameters

      • x: any

        The variable for which to test the type

      Returns string

      Returns the name of the type. Primitive types are lower case, non-primitive types are upper-camel-case. For example ‘number’, ‘string’, ‘Array’, ‘Date’.

    • Inverse the sign of a value, apply a unary minus operation. For matrices, the function is evaluated element wise. Boolean values and strings will be converted to a number. For complex numbers, both real and complex value are inverted.

      Type Parameters

      Parameters

      • x: T

        Number to be inverted

      Returns T

      Returns the value with inverted sign

    • Unary plus operation. Boolean values and strings will be converted to a number, numeric values will be returned as is. For matrices, the function is evaluated element wise.

      Type Parameters

      Parameters

      • x: T

        Input value

      Returns T

      Returns the input value when numeric, converts to a number when input is non-numeric.

    • Test whether two values are unequal. The function tests whether the relative difference between x and y is larger than the configured relTol and absTol. The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise. In case of complex numbers, x.re must unequal y.re, or x.im must unequal y.im. Values null and undefined are compared strictly, thus null is unequal with everything except null, and undefined is unequal with everything except undefined.

      Parameters

      • x: string | MathType

        First value to compare

      • y: string | MathType

        Second value to compare

      Returns boolean | MathCollection<MathNumericType>

      Returns true when the compared values are unequal, else returns false

    • Create a unit. Depending on the passed arguments, the function will create and return a new math.type.Unit object. When a matrix is provided, all elements will be converted to units.

      Parameters

      • unit: string

        The unit to be created

      Returns Unit

      The created unit

    • Parameters

      • unit: Unit

        The unit to be created

      Returns Unit

      The created unit

    • Parameters

      • value: MathNumericType

        The value of the unit to be created

      • Optionalunit: string

        The unit to be created

      Returns Unit

      The created unit

    • Parameters

      Returns Unit[]

    • Solves the linear equation system by backward substitution. Matrix must be an upper triangular matrix. U * x = b

      Parameters

      Returns Matrix

      A column vector with the linear system solution (x)

    • Parameters

      Returns MathArray

    • Compute the variance of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the variance over all elements will be calculated. Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following values: 'unbiased' (default) The sum of squared errors is divided by (n - 1) 'uncorrected' The sum of squared errors is divided by n 'biased' The sum of squared errors is divided by (n +

      1. Note that older browser may not like the variable name var. In that case, the function can be called as math'var' instead of math.variance(...).

      Parameters

      Returns MathNumericType

      The variance

    • Compute the variance of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the variance over all elements will be calculated. Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following values: 'unbiased' (default) The sum of squared errors is divided by (n - 1) 'uncorrected' The sum of squared errors is divided by n 'biased' The sum of squared errors is divided by (n +

      1. Note that older browser may not like the variable name var. In that case, the function can be called as math'var' instead of math.variance(...).

      Parameters

      • array: MathCollection

        A matrix to compute variance.

      • Optionaldimension: number

        A dimension to compute variance on

      • Optionalnormalization: "unbiased" | "uncorrected" | "biased"

        normalization Determines how to normalize the variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value: ‘unbiased’.

      Returns MathNumericType[]

      variance matrix.

    • Parameters

      • array: MathCollection

        A single matrix

      • normalization: "unbiased" | "uncorrected" | "biased"

        normalization Determines how to normalize the variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value: ‘unbiased’.

      Returns MathNumericType

      The variance

    • Create a matrix filled with zeros. The created matrix can have one or multiple dimensions.

      Parameters

      • Optionalsize: number | number[] | BigNumber | BigNumber[]

        The size of each dimension of the matrix

      • Optionalformat: string

        The matrix storage format

      Returns MathCollection

      A matrix filled with zeros

    • Parameters

      • m: number | BigNumber

        The x dimension of the matrix

      • n: number | BigNumber

        The y dimension of the matrix

      • Optionalformat: string

        The matrix storage format

      Returns MathCollection

      A matrix filled with zeros

    • Parameters

      • m: number | BigNumber

        The x dimension of the matrix

      • n: number | BigNumber

        The y dimension of the matrix

      • p: number | BigNumber

        The z dimension of the matrix

      • Optionalformat: string

        The matrix storage format

      Returns MathCollection

      A matrix filled with zeros

    • Compute the Riemann Zeta function of a value using an infinite series and Riemann's Functional equation.

      Type Parameters

      Parameters

      • s: T

        A real, complex or BigNumber

      Returns T

      The Riemann Zeta of s

    • Compute the transfer function of a zero-pole-gain model.

      Type Parameters

      Parameters

      • z: T

        Zeroes of the model

      • p: T

        Poles of the model

      • Optionalk: number

        Gain of the model

      Returns T

      The transfer function as array of numerator and denominator