mathmaker  0.4(alpha)
Public Member Functions | Properties
core.base_calculus.Monomial Class Reference

A Monomial is a Product of a numeric Exponented and a literal Item. More...

Inheritance diagram for core.base_calculus.Monomial:
core.base_calculus.Product core.base_calculus.CommutativeOperation core.base_calculus.Operation core.root_calculus.Exponented core.root_calculus.Signed core.root_calculus.Calculable core.root_calculus.Evaluable core.base.Printable core.base.NamedObject core.base.Clonable

List of all members.

Public Member Functions

def __init__
 Constructor.
def get_sign
 Gets the sign of the Monomial.
def get_coeff
 Returns the numeric coefficient of the Monomial.
def get_raw_value
 Gets the value of a Monomial of degree 0.
def get_first_letter
 Returns the letter of the Monomial.
def get_degree
 Returns the degree of the Monomial (i.e.
def get_value_inside
 Gets the Value of the Monomial, just to mimic the case when it is of degree 0.
def set_letter
 Sets the letter of the Monomial.
def set_degree
 Set the degree of the Monomial.
def set_coeff
 Set the degree of the Monomial.
def dbg_str
 Raw display of the Monomial (debugging method)
def is_null
 True if it's the null Monomial.
def is_numeric
 True if Monomial's degree is 0 or ZERO_POLYNOMIAL_DEGREE.
def is_positive
 True if Monomial's coefficient's *sign* is '+'.
def is_negative
 True if Monomial's coefficient's *sign* is '-'.

Properties

 sign = property(get_sign, doc = "Monomial's sign")
 coeff = property(get_coeff, doc = "Monomial's coefficient")
 raw_value = property(get_raw_value, doc = "0-degree-Monomial's value")
 degree = property(get_degree, doc = "Monomial's degree")
 letter = property(get_first_letter, doc = "Monomial's letter")
 value_inside

Detailed Description

A Monomial is a Product of a numeric Exponented and a literal Item.

Definition at line 7521 of file base_calculus.py.


Constructor & Destructor Documentation

def core.base_calculus.Monomial.__init__ (   self,
  arg,
  options 
)

Constructor.

Warning:
Might raise an UncompatibleType exception.
Parameters:
argDEFAULT|Monomial|(sign, coeff, degree)|....... Possible arguments are :
  • DEFAULT, which is equivalent to ('+', 1, 0)
  • another Monomial which will be copied
  • (sign, coeff, degree) where coeff is a number and degree an integer
  • (coeff, degree) where coeff's numeric Exponented & degree an integer
  • (RANDOMLY, max_coeff, max_degree) where max_* are integers A Monomial will always be by default compact displayed (i.e. 2x and not 2×x). If the argument isn't of the kinds listed above, an exception will be raised.
optionsany option Options can be :
  • randomly_plus_signs_ratio : will be effective only in the case of (RANDOMLY, max_coeff, max_degree) arg. In this case, the random choice of the sign of the Monomial will respect the given ratio
Returns:
A instance of Monomial

Definition at line 7549 of file base_calculus.py.

References core.base_calculus.CommutativeOperation._compact_display, core.base_calculus.Product._compact_display, core.base_calculus.Sum._compact_display, core.base_calculus.Monomial._compact_display, core.base_calculus.Operation._element, core.base_calculus.Item._exponent, core.base_calculus.Function._exponent, core.base_calculus.Quotient._exponent, core.base_calculus.Fraction._exponent, core.base_calculus.Product._exponent, core.base_calculus.Sum._exponent, core.base_calculus.Monomial._exponent, core.base_calculus.CommutativeOperation._info, core.base_calculus.Monomial._info, core.base_calculus.Operation._neutral, core.base_calculus.Product._neutral, core.base_calculus.Sum._neutral, core.base_calculus.Monomial._neutral, core.base_calculus.Item._value_inside, core.base_calculus.Function._value_inside, core.base_calculus.Monomial._value_inside, core.base.Clonable.clone(), core.base_calculus.Operation.element, core.base_calculus.Product.factor, core.base_calculus.Monomial.is_null(), core.base_calculus.Monomial.is_numeric(), and core.root_calculus.Exponented.set_exponent().

Referenced by core.calculus.Equation.__init__(), and core.root_calculus.Value.substitute().


Member Function Documentation

def core.base_calculus.Monomial.dbg_str (   self,
  options 
)

Returns the numeric coefficient of the Monomial.

Returns:
The numeric coefficient of the Monomial

Definition at line 7664 of file base_calculus.py.

References core.base_calculus.Product.factor.

Returns the degree of the Monomial (i.e.

exponent of factor[1])

Returns:
The degree of the Monomial

Definition at line 7698 of file base_calculus.py.

References core.base_calculus.Product.factor.

Returns the letter of the Monomial.

Returns:
The letter of the Monomial

Reimplemented from core.base_calculus.CommutativeOperation.

Definition at line 7687 of file base_calculus.py.

References core.base_calculus.Product.factor.

Referenced by core.root_calculus.Evaluable.alphabetical_order_cmp(), and core.root_calculus.Value.into_str().

Gets the value of a Monomial of degree 0.

Warning:
Raises an error if asked on non-degree-0 Monomial
Returns:
value_inside.raw_value

Definition at line 7676 of file base_calculus.py.

References core.base_calculus.Item.value_inside, and core.base_calculus.Monomial.value_inside.

Gets the Value of the Monomial, just to mimic the case when it is of degree 0.

Returns:
value_inside

Definition at line 7710 of file base_calculus.py.

References core.base_calculus.Item._value_inside, core.base_calculus.Function._value_inside, and core.base_calculus.Monomial._value_inside.

True if Monomial's coefficient's *sign* is '-'.

Todo:
How to answer to the question if this Monomial is null ?

Reimplemented from core.root_calculus.Signed.

Definition at line 7831 of file base_calculus.py.

References core.base_calculus.Operation.element.

Referenced by core.base_calculus.Item.get_minus_signs_nb(), core.base_calculus.SquareRoot.get_minus_signs_nb(), and core.base_calculus.Item.requires_inner_brackets().

True if Monomial's coefficient's *sign* is '+'.

Todo:
How to answer to the question if this Monomial is null ?

Reimplemented from core.root_calculus.Signed.

Definition at line 7819 of file base_calculus.py.

References core.base_calculus.Operation.element.

Referenced by core.base_calculus.Item.evaluate().


Property Documentation

core::base_calculus.Monomial::value_inside [static]
Initial value:
property(get_value_inside,
                            doc = "0-degree Monomial's Value inside")

Definition at line 7727 of file base_calculus.py.

Referenced by core.base_calculus.Monomial.get_raw_value().


The documentation for this class was generated from the following file: