PiMath API
    Preparing search index...

    Interface RandomEquationConfig

    Options of rndEquation.

    interface RandomEquationConfig {
        allow?: { commonFactor?: boolean; negativeLeading?: boolean };
        degree?: number;
        factorable?: boolean;
        fraction?: boolean | RandomCoefficientConfig;
        shuffle?: boolean;
        solution?: {
            allowZero?: boolean;
            count?: number;
            everything?: number | boolean;
            nothing?: number | boolean;
            range?: RandomRange;
            relative?: boolean;
        };
        unit?: boolean;
        variables?: string;
    }
    Index
    allow?: { commonFactor?: boolean; negativeLeading?: boolean }

    Type Declaration

    • OptionalcommonFactor?: boolean

      Allow a common factor between the integer coefficients (default true).

    • OptionalnegativeLeading?: boolean

      Allow a negative leading coefficient (default false).

    degree?: number

    Degree, a non-negative integer (default 1).

    factorable?: boolean

    Build the equation from a product of factors, so that its solutions are controlled (default false).

    fraction?: boolean | RandomCoefficientConfig

    Coefficients: false (default) gives integers, true fractions, an object gives full control.

    shuffle?: boolean

    Add a random polynom to both sides: P = 0 becomes P + Q = Q (default false).

    solution?: {
        allowZero?: boolean;
        count?: number;
        everything?: number | boolean;
        nothing?: number | boolean;
        range?: RandomRange;
        relative?: boolean;
    }

    Type Declaration

    • OptionalallowZero?: boolean

      Allow 0 as a solution (default true). It lives in solution rather than in allow: it constrains the solutions of the equation, not its coefficients.

    • Optionalcount?: number

      Exact number of distinct real solutions, from 0 to degree. Implies a factored construction (default: unset, the number is free).

    • Optionaleverything?: number | boolean

      Equation true for every value: true, false (default), or a probability between 0 and 1.

    • Optionalnothing?: number | boolean

      Equation without solution: true, false (default), or a probability between 0 and 1.

    • Optionalrange?: RandomRange

      Interval of the solutions, and of the constant added by nothing (default 5, i.e. [-5, 5]): a number d means [-|d|, |d|], {min, max} gives explicit bounds. Fractional solutions follow the fraction configuration, within this interval.

    • Optionalrelative?: boolean

      Force integer solutions of either sign, like relative for a fraction (default false).

    unit?: boolean

    Force a leading coefficient equal to 1 (default false).

    variables?: string

    Variables of the equation, one lowercase letter each (default 'x').