Interface RCFNum<Name>

A Real Closed Field (RCF) numeral.

RCF numerals can represent:

  • Rational numbers
  • Algebraic numbers (roots of polynomials)
  • Transcendental extensions (e.g., pi, e)
  • Infinitesimal extensions
const { RCFNum } = Context('main');

// Create pi
const pi = RCFNum.pi();
console.log(pi.toDecimal(10)); // "3.1415926536"

// Create a rational
const half = new RCFNum('1/2');

// Arithmetic
const sum = pi.add(half);

// Check properties
console.log(pi.isTranscendental()); // true
console.log(half.isRational()); // true
interface RCFNum<Name extends string = "main"> {
    add(other: RCFNum<Name>): RCFNum<Name>;
    div(other: RCFNum<Name>): RCFNum<Name>;
    eq(other: RCFNum<Name>): boolean;
    ge(other: RCFNum<Name>): boolean;
    gt(other: RCFNum<Name>): boolean;
    inv(): RCFNum<Name>;
    isAlgebraic(): boolean;
    isInfinitesimal(): boolean;
    isRational(): boolean;
    isTranscendental(): boolean;
    le(other: RCFNum<Name>): boolean;
    lt(other: RCFNum<Name>): boolean;
    mul(other: RCFNum<Name>): RCFNum<Name>;
    neg(): RCFNum<Name>;
    neq(other: RCFNum<Name>): boolean;
    power(k: number): RCFNum<Name>;
    sub(other: RCFNum<Name>): RCFNum<Name>;
    toDecimal(precision: number): string;
    toString(compact?: boolean): string;
}

Type Parameters

  • Name extends string = "main"

Methods

  • Check if this RCF numeral is an algebraic number.

    Returns boolean

    true if this is algebraic

  • Check if this RCF numeral is an infinitesimal.

    Returns boolean

    true if this is infinitesimal

  • Check if this RCF numeral is a rational number.

    Returns boolean

    true if this is rational

  • Check if this RCF numeral is a transcendental number.

    Returns boolean

    true if this is transcendental

  • Convert this RCF numeral to a decimal string.

    Parameters

    • precision: number

      Number of decimal places

    Returns string

    Decimal string representation

  • Convert this RCF numeral to a string.

    Parameters

    • Optionalcompact: boolean

      If true, use compact representation

    Returns string

    String representation