
term Specification SheetComputer Algebra Kit (c) 1993,00 by Comp.Alg.Objects. All Rights Reserved.
TermInherits from: CAObject
Class DescriptionMaturity Index : Relatively MatureA term consists of a coefficient multiplied by a symbol raised to an integral exponent. The coefficient is a scalar object or a polynomial. The symbol object is nil if the exponent is equal to zero.
Recursive PolynomialsA polynomial in recursive representation is a sum of terms. If the polynomial is variable sparse, each symbol can be different and the coefficients of the terms are scalar objects or again variable sparse polynomials; if the coefficient is not a scalar object, then the exponent of the term cannot be zero (for example, the term 3 x^0 y^2 z^0 is reduced to 3 y^2 in the variable sparse case). If the polynomial is variable dense, all symbols are equal to each other and the coefficients are either all scalar objects or again all variable dense polynomials; the exponent of a term may be zero, even if the coefficient is a polynomial (3 x^0 y^2 z^0 is a valid object in the variable dense case). In a degree dense polynomial, the coefficients of the terms can be zero; in a degree sparse polynomial they cannot.
MonomialsA monomial is a product of terms. The coefficients of the terms of a monomial are scalar objects that are equal to one (but it's possible to insert terms with a nontrivial coefficient). In a variable dense monomial, the exponents of the terms can be equal to zero; in a variable sparse monomial, they cannot.
FactorsA factored polynomial is a product of terms. The coefficients of the terms in the factorization are scalar objects, mostly equal to one, but they can store the content extracted out of the (primitive) factors. The symbol (nucleus) objects of the terms are polynomials i.e., the factors in the factorization.
Method typesCreationIdentityCoercionAdditionMultiplication
ExponentationCharacteristicDerivation and IntegrationPrintingMethodsscalar:symbol:exponent:+scalar:aScalarsymbol:aSymbolexponent:(int)anExponentCreates a new term with coefficient, symbol and exponent set to the specified objects. This method sets scalarZero to the zero element for aScalar.
coefficient:symbol:exponent:+coefficient:aCoefficientsymbol:aSymbolexponent:(int)anExponentCreates a new term with coefficient, symbol and exponent set to the specified objects. This method sets scalarZero to the zero element obtained by sending scalarZero to aCoefficient.
copycopyCopies the term object, and if the coefficient is a scalar object, adds a reference to it. If the coefficient is a polynomial, makes a copy of it. See also: copy (Polynomial)
deepCopydeepCopyMakes deep copies of the term object and its coefficient and symbol. See also: deepCopy (Polynomial)
scalarZeroscalarZeroReturns the zero scalar of the term.
coefficientcoefficientReturns the coefficient of the term.
symbolsymbolReturns the symbol of the term. If the exponent of the term is equal to zero, this method returns nil.
exponent (int)exponentReturns the exponent of the term. If the exponent is equal to zero, the symbol of the term is equal to nil.
degree (int)degreeEquivalent to exponent.
hash (unsigned)hashReturns a small integer that is the same for terms that are equal (in the sense of isEqual:).
isEqual: (BOOL)isEqual:bTwo terms are equal if they are pointer equal or if the coefficients are equal, if the exponents are equal and if the symbols are equal (or both nil).
compareExponents: (int)compareExponents:bCompares two terms with respect to symbols and exponents; this imposes an ordering for the terms in variable sparse polynomials. Returns zero if the terms are pointer equal. A term with symbol nil is less than a term with nonnil symbol. Compares the symbols, and if they are equal, compares the exponents.
intValue (int)intValueReturns, if the exponent is equal to zero, the intValue of the coefficient. If not, generates an error message.
intValue:intValue:(int)aValueReturns a new term with exponent equal to zero and with a coefficient whose value as int is equal to aValue.
floatValue (float)floatValueReturns, if the exponent is equal to zero, the floatValue of the coefficient. If not, generates an error message.
floatValue:floatValue:(float)aValueReturns a term with exponent equal to zero and with a coefficient whose value as float is equal to aValue.
asScalarasScalarReturns the term as scalar object. Returns nil if the exponent of the term is not equal to zero. If the coefficient of the term is a scalar, the method returns a new reference to it, otherwise the coefficient is a polynomial and the method returns the scalar value of it. Note that in the variable sparse case, a term that is a scalar must have a scalar object as coefficient i.e., the term is always simplified.
asSymbolasSymbolReturns the term as symbol object. If the exponent of the term is zero and if the coefficient is a polynomial, returns the symbol value of the polynomial. If the exponent is equal to one and the coefficient is one, returns a new reference to the symbol of the term. Otherwise returns nil.
zerozeroReturns a new term with coefficient equal to the zero element for the coefficient of the term that receives the message.
isZero (BOOL)isZeroWhether the coefficient of the term is equal to zero. The exponent of the term may be nonzero.
isOpposite: (BOOL)isOpposite:bWhether the coefficients of the term are opposite, and the exponents and symbols are equal to each other.
negatenegateNegates the coefficient of the term.
doubledoubleDoubles the coefficient of the term.
add:add:bReturns a new term that is the sum of the two terms i.e., the coefficients are added together using add: or addScalar:. The exponents must be equal and the symbols must be both nil or equal to each other.
subtract:subtract:bReturns a new term that is the difference of the two terms i.e., the coefficients are subtracted from each other using subtract: or subtractScalar:. The exponents must be equal and the symbols must be both nil or equal to each other.
oneoneReturns a term with coefficient equal to one.
isOne (BOOL)isOneWhether the coefficient is one and the exponent is equal to zero.
isMinusOne (BOOL)isMinusOneWhether the coefficient is minus one and the exponent is equal to zero.
squaresquareSquares coefficient and multiplies exponent by two.
inverseinverseInverts coefficient and negates the exponent. Returns nil if the coefficient has no inverse.
multiplyScalar:multiplyScalar:bReturns a new term; multiplies the coefficient of the term by the scalar object b, using multiply: if the coefficient of the term is a scalar object, or multiplyScalar: otherwise. The symbol and exponent of the resulting term are equal to that of the original term.
multiplyCoefficient:multiplyCoefficient:bReturns a new term; multiplies the coefficient of the term by the coefficient object b, which must be an instance of the same class as the coefficient of the term. The symbol and exponent of the resulting term are equal to that of the original term. The method is implemented only for terms of variable dense (recursive) polynomials.
multiply:multiply:bReturns a new term that is the product of the two terms i.e., the exponents are added together and the coefficients are multiplied using multiply: or multiplyScalar:. If the exponents are both nonzero, then the symbols must be equal to each other. If one of the terms has exponent equal to zero, then the symbol of the resulting term is equal to that of the term with nonzero exponent.
divideScalar:divideScalar:bReturns a new term; divides the coefficient of the term by the scalar object b, using divide: if the coefficient of the term is a scalar object, or divideScalar: otherwise. The symbol and exponent of the resulting term are equal to that of the original term. Returns nil if the scalar division is not exact.
divideCoefficient:divideCoefficient:bReturns a new term; divides the coefficient of the term by the object b, which is an instance of the same class as the coefficient. The symbol and exponent of the resulting term are equal to that of the original term. Returns nil if the division is not exact. The method is implemented only for terms of a variable dense polynomial.
divide:divide:bReturns a new term that is the exact quotient of the two terms i.e., the exponents are subtracted from each other and the coefficients are divided using divide: or divideScalar:. If the exponents are both nonzero, then the symbols must be equal to each other. If one of the terms has exponent equal to zero, then the symbol of the resulting term is equal to that of the term with nonzero exponent. Returns nil if the exponent of the divisor is greater than that of the dividend, or if the coefficient division fails.
power:power:(int)nRaises coefficient to the nth power and multiplies exponent by n.
root:root:(int)nTakes the nth root of the coefficient and divides exponent by n. Returns nil if the coefficient is not an nth power or if the exponent is not divisible by n.
squareRootsquareRootTakes the square root of the coefficient and divides exponent by two. Returns nil if the coefficient is not a square or if the exponent is not divisible by two.
frobeniusfrobeniusReturns the pth power of the term, obtained by raising the term to a power equal to the characteric of the coefficient.
frobeniusInversefrobeniusInverseReturns either nil (if the term is not a pth power) or a new term that is the pth root of the term.
derivederiveReturns the derivative with respect to the variable.
integrateintegrateIntegrates with respect to the variable.
printsLeadingSign (BOOL)printsLeadingSignWhether the term prints a leading minus sign.
printsSum (BOOL)printsSumWhether the term prints a sum.
printsProduct (BOOL)printsProductWhether the term prints a single product.
printOn:printOn:(IOD)aFilePrints, between braces, a comma separated list of the members. If there are no members, the method prints two braces.
