Class Term
Defined in: Term.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Term(coefficient, power, variable)
Constructor for a term of a polynomial
|
Field Attributes | Field Name and Description |
---|---|
<static> <constant> |
Term.serializeName
A static constant to help with de/serialization
|
Method Attributes | Method Name and Description |
---|---|
add(summand)
Adds a term,polynomial, or constant to an existing term
|
|
degree()
Returns the monomial's degree
|
|
divide(denominator)
Divide a term by another term or a constant
|
|
{Term}
|
exponentiate(exponent)
Produce powers of a Term
|
<static> |
Term.fromWebWorker(that)
Reattaches class methods to destringified object
|
initTerm(sterm)
This is an alternate constructor to initialize Term objects.
|
|
multiply(multiplicand)
Multiply a term, Polynomial, or constant to an existing term
|
|
{Term}
|
neg()
Returns the additive invese of the term
|
{double|Term}
|
resolve(value)
|
{String}
|
Generate a formated string representing a term.
|
subtract(summand)
Subtract a term, or constant from an existing term
|
|
{String}
|
toString()
Generates a pretty printed version of the term.
|
{Object}
|
Stringify the object but with additional property to help deserialization
|
Class Detail
Term(coefficient, power, variable)
Constructor for a term of a polynomial
- Parameters:
- {double} coefficient
- The coefficient of the term.
- {double|double[]} power
- The power of the variable in the term.
- {string|string[]} variable
- The name of the variable involved in the term
Field Detail
<static> <constant>
Term.serializeName
A static constant to help with de/serialization
Method Detail
{Term|Polynomial}
add(summand)
Adds a term,polynomial, or constant to an existing term
- Parameters:
- {Term|Polynomial|double} summand
- The summad being added to the term
- Returns:
- {Term|Polynomial} The result of the summation
degree()
Returns the monomial's degree
{Term|Polynomial}
divide(denominator)
Divide a term by another term or a constant
- Parameters:
- {Term|double} denominator
- The denominator of the divisor
- Returns:
- {Term|Polynomial} The quotient
{Term}
exponentiate(exponent)
Produce powers of a Term
- Parameters:
- {Integer} exponent
- the power to be raised by
- Returns:
- {Term} the power of the input
<static>
Term.fromWebWorker(that)
Reattaches class methods to destringified object
- Parameters:
- {Object} that
- A Term stripped of methods
initTerm(sterm)
This is an alternate constructor to initialize Term objects.
This is meant to be used in conjunction witht the serialize() method
- Parameters:
- {String} sterm
- A string of the form ax^b where a,b are floats, and x is any variable
{Term|Polynomial}
multiply(multiplicand)
Multiply a term, Polynomial, or constant to an existing term
- Parameters:
- {Term|Polynomial|double} multiplicand
- The multiplicand in the product
- Returns:
- {Term|Polynomial} The product
{Term}
neg()
Returns the additive invese of the term
- Returns:
- {Term}
{double|Term}
resolve(value)
- Parameters:
- {double|Object} value
- Evaluate the term for the value
- Returns:
- {double|Term} The result of the function
{String}
serialize()
Generate a formated string representing a term.
- Returns:
- {String} Return the term in formatted string
{Term|Polynomial}
subtract(summand)
Subtract a term, or constant from an existing term
- Parameters:
- {Term|double} summand
- The summand being subtract from the term
- Returns:
- {Term|Polynomial} The result of the summation
{String}
toString()
Generates a pretty printed version of the term.
- Returns:
- {String} Returns a string version of the term
{Object}
toWebWorker()
Stringify the object but with additional property to help deserialization
- Returns:
- {Object} object to JSON stringify