mathmaker
0.4(alpha)
|
It's the smallest displayable element (sign, value, exponent) The value can be either numeric or literal. More...
Public Member Functions | |
def | __init__ |
Constructor. | |
def | get_is_out_striked |
Gets the raw value of the Item. | |
def | get_force_display_sign_once |
Gets force_display_sign_once field. | |
def | get_raw_value |
Gets the raw value of the Item. | |
def | get_value_inside |
Gets the Value of the Item. | |
def | get_unit |
Returns the unit of the Item. | |
def | get_minus_signs_nb |
Gets the number of '-' signs of the Item. | |
def | get_iteration_list |
Returns the list of elements to iter over. | |
def | get_first_letter |
Returns the letter of the Item, in case it's a literal. | |
def | set_unit |
Set the unit of the Item. | |
def | set_is_out_striked |
Sets a value to the "is_out_striked" field If is_out_striked is set to True, the Item will be displayed out striked. | |
def | set_force_display_sign_once |
Sets a True|False value to the "force_display_sign_once" field. | |
def | set_value_inside |
Sets the Value inside. | |
def | into_str |
Creates a string of the given object in the given ML. | |
def | evaluate |
Returns the value of a numerically evaluable Item. | |
def | calculate_next_step |
Returns None|an Item. | |
def | expand_and_reduce_next_step |
Returns None (an Item can't get expanded nor reduced !) | |
def | dbg_str |
Raw display of the Item (debugging method) | |
def | __cmp__ |
Compares two Items. | |
def | __len__ |
Returns the Item's length. | |
def | multiply_symbol_is_required |
True if the usual writing rules require a × between two factors. | |
def | requires_brackets |
True if the argument requires brackets in a product For instance, a Sum with several terms or a negative Item. | |
def | requires_inner_brackets |
True if the object requires inner brackets The reason for requiring them is having a negative *value* and if the exponent is either : | |
def | contains_exactly |
Always False for an Item. | |
def | contains_a_rounded_number |
To check if this contains a rounded number... | |
def | round |
Returns the (numeric) Item once rounded to the given precision. | |
def | digits_number |
Returns the number of digits of a numerical Item. | |
def | needs_to_get_rounded |
Returns True/False depending on the need of the value to get rounded (for instance 2.68 doesn't need to get rounded if precision is HUNDREDTH or more, but needs it if it is less) If the Item is not numeric, or if the given precision is incorrect, the matching call to the Value will raise an exception. | |
def | turn_into_fraction |
Turns the Item into the fraction item itself over item 1. | |
def | is_numeric |
True if it's a numeric Item. | |
def | is_literal |
True if it's a literal Item. | |
def | is_null |
True if it's the null Item. | |
def | is_displ_as_a_single_1 |
True if it's positive w/ (exponent 0 or numeric w/ value 1) | |
def | is_displ_as_a_single_minus_1 |
True if it's negative w/ (exponent 0 or numeric w/ value 1) | |
def | is_displ_as_a_single_0 |
True if self.is_null() | |
def | is_displ_as_a_single_numeric_Item |
True if the Item is numeric. | |
def | is_displ_as_a_single_int |
True if the object can be displayed as a single int. | |
def | is_displ_as_a_single_neutral |
True if the object can be considered as a neutral element. | |
def | is_expandable |
False. | |
Public Attributes | |
sign | |
exponent | |
Properties | |
is_out_striked | |
force_display_sign_once | |
raw_value = property(get_raw_value, doc = "Item's raw value") | |
value_inside = property(get_value_inside, doc = "Item's Value") | |
unit = property(get_unit, doc = "Unit of the Item") |
It's the smallest displayable element (sign, value, exponent) The value can be either numeric or literal.
Definition at line 81 of file base_calculus.py.
def core.base_calculus.Item.__init__ | ( | self, | |
arg | |||
) |
Constructor.
arg | None|Number|String|Item|(sign,value,exponent)| (sign,number|letter|Value)|0-degree Monomial|Value Possible arguments can be :
|
Reimplemented in core.base_calculus.Function.
Definition at line 108 of file base_calculus.py.
References core.base_calculus.Item._exponent, core.base_calculus.Item._force_display_sign_once, core.base_calculus.Item._is_out_striked, core.base_calculus.Item._sign, core.base_calculus.Item._unit, core.base_calculus.Item._value_inside, and core.base.Clonable.clone().
Referenced by core.calculus.Equation.__init__(), and core.root_calculus.Value.substitute().
def core.base_calculus.Item.__cmp__ | ( | self, | |
other_item | |||
) |
Compares two Items.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 644 of file base_calculus.py.
References core.base_calculus.Item.exponent, core.base_calculus.Item.raw_value, and core.base_calculus.Item.sign.
def core.base_calculus.Item.__len__ | ( | self | ) |
Returns the Item's length.
Reimplemented from core.root_calculus.Calculable.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 663 of file base_calculus.py.
def core.base_calculus.Item.calculate_next_step | ( | self, | |
options | |||
) |
Returns None|an Item.
Reimplemented from core.root_calculus.Calculable.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 522 of file base_calculus.py.
References core.base_calculus.Item.dbg_str(), core.base_calculus.Item.is_numeric(), core.base_calculus.Item.raw_value, and core.base_calculus.Item.sign.
Referenced by core.base_calculus.Quotient.evaluate(), core.base_calculus.CommutativeOperation.evaluate(), core.base_calculus.Item.expand_and_reduce_next_step(), core.base_calculus.SquareRoot.expand_and_reduce_next_step(), core.base_calculus.Fraction.expand_and_reduce_next_step(), core.base_calculus.Product.expand_and_reduce_next_step(), and core.base_calculus.Sum.expand_and_reduce_next_step().
To check if this contains a rounded number...
Reimplemented from core.root_calculus.Evaluable.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 851 of file base_calculus.py.
References core.base_calculus.Item.value_inside.
def core.base_calculus.Item.contains_exactly | ( | self, | |
objct | |||
) |
Always False for an Item.
objct | The object to search for |
Reimplemented from core.root_calculus.Evaluable.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 839 of file base_calculus.py.
def core.base_calculus.Item.dbg_str | ( | self, | |
options | |||
) |
Raw display of the Item (debugging method)
options | No option available so far |
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 622 of file base_calculus.py.
References core.base_calculus.Item.is_out_striked, core.base_calculus.Item.raw_value, and core.base_calculus.Item.sign.
Referenced by core.base_calculus.Polynomial.__init__(), core.base_calculus.Item.calculate_next_step(), core.base_calculus.Fraction.calculate_next_step(), core.base_calculus.CommutativeOperation.evaluate(), core.base_calculus.Product.expand_and_reduce_next_step(), core.base_calculus.Sum.expand_and_reduce_next_step(), core.base_calculus.Product.get_factors_list(), core.base_calculus.Product.get_factors_list_except(), core.base_calculus.Quotient.into_str(), core.base_calculus.Product.into_str(), core.base_calculus.Item.is_displ_as_a_single_neutral(), core.base_calculus.Product.reduce_(), core.base_calculus.Sum.reduce_(), core.base_calculus.CommutativeOperation.remove(), core.base_calculus.Fraction.replace_striked_out(), core.root_calculus.Signed.set_opposite_sign(), core.root_calculus.Value.set_opposite_sign(), core.base_calculus.Fraction.simplified(), and core.calculus.Equation.solve_next_step().
def core.base_calculus.Item.evaluate | ( | self | ) |
Returns the value of a numerically evaluable Item.
Reimplemented from core.root_calculus.Evaluable.
Definition at line 497 of file base_calculus.py.
References core.base_calculus.Item.is_numeric(), core.root_calculus.Signed.is_positive(), core.base_calculus.Monomial.is_positive(), and core.base_calculus.Item.raw_value.
Referenced by core.base_calculus.Quotient.calculate_next_step(), core.base_calculus.Product.calculate_next_step(), and core.base_calculus.Sum.is_null().
def core.base_calculus.Item.expand_and_reduce_next_step | ( | self, | |
options | |||
) |
Returns None (an Item can't get expanded nor reduced !)
Reimplemented from core.root_calculus.Calculable.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 607 of file base_calculus.py.
References core.base_calculus.Item.calculate_next_step(), and core.base_calculus.Item.is_numeric().
Referenced by core.base_calculus.Product.calculate_next_step(), and core.base_calculus.Sum.calculate_next_step().
Gets force_display_sign_once field.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 216 of file base_calculus.py.
References core.base_calculus.Item._force_display_sign_once.
def core.base_calculus.Item.get_is_out_striked | ( | self | ) |
Gets the raw value of the Item.
Definition at line 205 of file base_calculus.py.
References core.base_calculus.Item._is_out_striked.
def core.base_calculus.Item.get_minus_signs_nb | ( | self | ) |
Gets the number of '-' signs of the Item.
Reimplemented from core.root_calculus.Signed.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 259 of file base_calculus.py.
References core.base_calculus.Item.exponent, core.root_calculus.Signed.is_negative(), core.base_calculus.Monomial.is_negative(), core.base_calculus.Item.is_null(), and core.base_calculus.Item.raw_value.
def core.base_calculus.Item.get_raw_value | ( | self | ) |
Gets the raw value of the Item.
Definition at line 227 of file base_calculus.py.
References core.base_calculus.Item.value_inside.
def core.base_calculus.Item.get_value_inside | ( | self | ) |
Gets the Value of the Item.
Definition at line 238 of file base_calculus.py.
References core.base_calculus.Item._value_inside.
def core.base_calculus.Item.into_str | ( | self, | |
options | |||
) |
Creates a string of the given object in the given ML.
options | Any options |
Reimplemented from core.base.Printable.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 381 of file base_calculus.py.
References core.base_calculus.Item.exponent, core.root_calculus.Exponented.exponent_must_be_displayed(), core.base_calculus.Item.force_display_sign_once, core.base_calculus.Item.is_null(), core.base_calculus.Item.is_numeric(), core.base_calculus.Item.is_out_striked, core.base_calculus.Item.requires_inner_brackets(), core.base_calculus.Item.set_force_display_sign_once(), core.base_calculus.Item.sign, and core.base_calculus.Item.unit.
def core.base_calculus.Item.is_expandable | ( | self | ) |
False.
Reimplemented in core.base_calculus.SquareRoot, and core.base_calculus.Function.
Definition at line 1051 of file base_calculus.py.
def core.base_calculus.Item.multiply_symbol_is_required | ( | self, | |
objct, | |||
position | |||
) |
True if the usual writing rules require a × between two factors.
objct | The other one |
position | The position (integer) of self in the Product |
Reimplemented from core.root_calculus.Calculable.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 675 of file base_calculus.py.
References core.root_calculus.Exponented.exponent_must_be_displayed(), core.base_calculus.Item.is_displ_as_a_single_1(), core.base_calculus.Item.is_literal(), core.base_calculus.Item.is_numeric(), core.base_calculus.Item.multiply_symbol_is_required(), core.base_calculus.Item.raw_value, and core.base_calculus.Item.requires_brackets().
Referenced by core.base_calculus.Item.multiply_symbol_is_required(), core.base_calculus.Product.multiply_symbol_is_required(), and core.base_calculus.Sum.multiply_symbol_is_required().
def core.base_calculus.Item.needs_to_get_rounded | ( | self, | |
precision | |||
) |
Returns True/False depending on the need of the value to get rounded (for instance 2.68 doesn't need to get rounded if precision is HUNDREDTH or more, but needs it if it is less) If the Item is not numeric, or if the given precision is incorrect, the matching call to the Value will raise an exception.
Definition at line 895 of file base_calculus.py.
Referenced by core.root_calculus.Value.round().
def core.base_calculus.Item.requires_brackets | ( | self, | |
position | |||
) |
True if the argument requires brackets in a product For instance, a Sum with several terms or a negative Item.
position | The position of the object in the Product |
Reimplemented from core.root_calculus.Calculable.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 747 of file base_calculus.py.
References core.base_calculus.Item.is_literal(), core.base_calculus.Item.raw_value, and core.base_calculus.Item.sign.
Referenced by core.base_calculus.Item.multiply_symbol_is_required().
def core.base_calculus.Item.requires_inner_brackets | ( | self | ) |
True if the object requires inner brackets The reason for requiring them is having a negative *value* and if the exponent is either :
Case of non-Item-Exponented exponents probably is to be improved
Case of numerator-only equivalent Quotients not made so far
Reimplemented from core.root_calculus.Calculable.
Reimplemented in core.base_calculus.SquareRoot.
Definition at line 780 of file base_calculus.py.
References core.base_calculus.Item.exponent, core.base_calculus.Item.is_literal(), core.root_calculus.Signed.is_negative(), core.base_calculus.Monomial.is_negative(), core.base_calculus.Item.is_numeric(), core.base_calculus.Item.raw_value, and core.base_calculus.Item.sign.
Referenced by core.base_calculus.Item.into_str(), and core.base_calculus.Product.into_str().
def core.base_calculus.Item.set_unit | ( | self, | |
arg | |||
) |
Set the unit of the Item.
arg | String |
Definition at line 325 of file base_calculus.py.
References core.base_calculus.Item._unit.
core::base_calculus.Item::force_display_sign_once [static] |
property(get_force_display_sign_once,
doc = "Item's force_display_sign_once field")
Definition at line 309 of file base_calculus.py.
Referenced by core.base_calculus.Item.into_str(), core.base_calculus.SquareRoot.into_str(), and core.base_calculus.SquareRoot.requires_brackets().
core::base_calculus.Item::is_out_striked [static] |
property(get_is_out_striked,
doc = "Item's is_out_striked field")
Definition at line 306 of file base_calculus.py.
Referenced by core.base_calculus.Item.dbg_str(), and core.base_calculus.Item.into_str().