class interface MONOMIAL

creation

make (coeff: RATIONAL; t: TERM)

require

not coeff.is_zero

make_empty

— default coefficient is MOB_INTEGER 1

make_constant (const: RATIONAL)

make_term (t: TERM)

— default coefficient is MOB_INTEGER 1

feature(s) from TERM

termfactors: LINKED_LIST[FACTOR]

make_empty

— default coefficient is MOB_INTEGER 1

add_indeterminate_exponent (indet: INDETERMINATE; exponent: INTEGER)

require

indet /= Void;

exponent >= 0

add_variable_exponent (name: STRING; power: INTEGER)

— label on variable will be Void

require

name /= Void;

power >= 0

add_variable_label_exponent (variable: STRING; label: STRING; power: INTEGER)

require

variable /= Void;

label /= Void;

power >= 0

add_factor (fac: FACTOR)

— factors are inserted in lexicographic order

require

fac /= Void

clone_factors (other: TERM)

require

other /= Void

clone_term: like Current

— synonym for deep_copy

deep_twin: like Current

— Return a new object with the dynamic type of Current.
— The new object structure is recursively duplicated from the one
— attached to Current.

remove_factor (index: INTEGER)

require

index <= termfactors.upper;

index >= termfactors.lower

remove_factor_by_name (fac: FACTOR)

require

fac /= Void

is_like (other: TERM): BOOLEAN

require

other /= Void

infix "*" (other: MONOMIAL): MONOMIAL

require

other /= Void

divisible_by (other: TERM): BOOLEAN

require

other /= Void

infix "//" (other: MONOMIAL): MONOMIAL

require

other /= Void;

divisible_by(other)

infix "#^" (power: INTEGER): TERM

require

power >= 0

lcm (other: TERM): TERM

require

other /= Void

gcd (other: TERM): TERM

require

other /= Void

term_is_one: BOOLEAN

is_relatively_prime_to (other: TERM): BOOLEAN

print_text

print_latex

print_html

exponent_vector: ARRAY[INTEGER]

— if you want to know which variables apply to these exponents, use variable_vector

variable_vector: ARRAY[INDETERMINATE]

— does not clone the indeterminates

is_equal (other: like Current): BOOLEAN

— Is other attached to an object considered equal to
— current object ?

require

other /= Void

ensure

generating_type = other.generating_type implies Result = other.is_equal(Current)

compose (inputs: ARRAY[COMPOSITION_PAIR]): POLYNOMIAL

— composes the variables of Current with inputs
— for each i, (inputs @ i).
— works with partial composition (i.e., not all variables are replaced)

infix "#@" (inputs: ARRAY[COMPOSITION_PAIR]): POLYNOMIAL

— synonym for compose

feature(s) from MONOMIAL

my_coeff: RATIONAL

make_constant (const: RATIONAL)

make (coeff: RATIONAL; t: TERM)

require

not coeff.is_zero

make_term (t: TERM)

— default coefficient is MOB_INTEGER 1

clone_monomial: like Current

— synonym for deep_copy

prefix "-": like Current

infix "+" (other: POLYNOMIAL): POLYNOMIAL

infix "-" (other: POLYNOMIAL): POLYNOMIAL

is_one: BOOLEAN

is_zero: BOOLEAN

end of MONOMIAL