mathmaker  0.6(alpha)
Public Member Functions | Public Attributes | Properties
core.base_calculus.BinomialIdentity Class Reference

These objects are expanded using : (a+b)² = a² + 2ab + b², (a-b)² = a² -2ab + b² and (a+b)(a-b) = a² - b² This object is a Product of two Sums but won't be displayed as is in the case of (a+b)² and (a-b)². More...

Inheritance diagram for core.base_calculus.BinomialIdentity:
core.base_calculus.Expandable 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_a
 Gets the 'a' term of the BinomialIdentity.
def get_b
 Gets the 'b' term of the BinomialIdentity.
def get_kind
 Gets the kind of BinomialIdentity it is.
def into_str
 Creates a string of the given object in the given ML.
def expand
 The expanded object, like (2x+3)² would return (2x)²+2×2x×3+3²
def expand_and_reduce_next_step
 Returns the next step of reduction of the BinomialIdentity.

Public Attributes

 str_openmark
 str_closemark

Properties

 a
 b
 kind

Detailed Description

These objects are expanded using : (a+b)² = a² + 2ab + b², (a-b)² = a² -2ab + b² and (a+b)(a-b) = a² - b² This object is a Product of two Sums but won't be displayed as is in the case of (a+b)² and (a-b)².

For instance, (3x-2)(3x-2) will be displayed (3x-2)². It would be complicated to derive BinomialIdentity from a Sum since a Sum isn't expandable. Let it derive simultaneously from Sum and Expandable could create problems when calling the into_str function (which of the Sum's or the Product's would be called ?).

Definition at line 8489 of file base_calculus.py.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
arg(Exponented, Exponented)|(RANDOMLY, <type>) Types details :
  • sum_square : matches (a+b)²
  • difference_square : matches (a-b)²
  • squares_difference : matches (a+b)(a-b) (name comes from a²-b²)
  • any : matches any of (a+b)², (a-b)², (-a+b)², (-a-b)², (a+b)(a-b)...
  • numeric_* : matches a numeric one...
optionssquares_difference Options details :
  • in the case of arg being (Exponented, Exponented), squares_difference let produce a (a+b)(a-b) from the given Exponenteds instead of a default (a+b)²
Warning:
Might raise an UncompatibleType exception.
Todo:
fix the square_difference option (see source code)

Reimplemented from core.base_calculus.Expandable.

Definition at line 8512 of file base_calculus.py.

References core.base_calculus.BinomialIdentity._a, core.base_calculus.BinomialIdentity._b, 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.Expandable._compact_display, core.base_calculus.BinomialIdentity._compact_display, 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.BinomialIdentity._exponent, core.base_calculus.CommutativeOperation._info, core.base_calculus.Monomial._info, core.base_calculus.Expandable._info, core.base_calculus.BinomialIdentity._info, core.base_calculus.BinomialIdentity._kind, core.base_calculus.Operation._neutral, core.base_calculus.Product._neutral, core.base_calculus.Sum._neutral, core.base_calculus.Monomial._neutral, core.base_calculus.Polynomial._neutral, core.base_calculus.Expandable._neutral, core.base_calculus.BinomialIdentity._neutral, core.base_calculus.Operation._symbol, core.base_calculus.Quotient._symbol, core.base_calculus.Fraction._symbol, core.base_calculus.Product._symbol, core.base_calculus.Sum._symbol, core.base_calculus.Expandable._symbol, core.base_calculus.BinomialIdentity._symbol, core.base.Clonable.clone(), core.base_calculus.Product.reduce_(), core.base_calculus.CommutativeOperation.str_closemark, core.base_calculus.Product.str_closemark, core.base_calculus.Sum.str_closemark, core.base_calculus.Expandable.str_closemark, core.base_calculus.BinomialIdentity.str_closemark, core.base_calculus.CommutativeOperation.str_openmark, core.base_calculus.Product.str_openmark, core.base_calculus.Sum.str_openmark, core.base_calculus.Expandable.str_openmark, and core.base_calculus.BinomialIdentity.str_openmark.

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


Member Function Documentation

Returns the next step of reduction of the BinomialIdentity.

Returns:
Exponented

Reimplemented from core.base_calculus.Expandable.

Definition at line 8815 of file base_calculus.py.

References core.base_calculus.Expandable.expand(), and core.base_calculus.BinomialIdentity.expand().

Gets the 'a' term of the BinomialIdentity.

Returns:
the content of the 'a' term

Definition at line 8694 of file base_calculus.py.

References core.base_calculus.BinomialIdentity._a.

Gets the 'b' term of the BinomialIdentity.

Returns:
the content of the 'b' term

Definition at line 8705 of file base_calculus.py.

References core.base_calculus.BinomialIdentity._b.

Gets the kind of BinomialIdentity it is.

Returns:
'sum_square'|'difference_square'|'squares_difference'

Definition at line 8716 of file base_calculus.py.

References core.base_calculus.BinomialIdentity._kind.

def core.base_calculus.BinomialIdentity.into_str (   self,
  options 
)

Creates a string of the given object in the given ML.

Parameters:
optionsAny options
Returns:
The formated string

Reimplemented from core.base_calculus.Product.

Definition at line 8742 of file base_calculus.py.

References core.base_calculus.BinomialIdentity.a, core.base_calculus.BinomialIdentity.b, core.base_calculus.Product.factor, and core.base_calculus.BinomialIdentity.kind.


Property Documentation

core::base_calculus.BinomialIdentity::a [static]
Initial value:
property(get_a,
                 doc="Gets the 'a' term of the BinomialIdentity")

Definition at line 8722 of file base_calculus.py.

Referenced by core.base_calculus.BinomialIdentity.expand(), and core.base_calculus.BinomialIdentity.into_str().

core::base_calculus.BinomialIdentity::b [static]
Initial value:
property(get_b,
                 doc="Gets the 'b' term of the BinomialIdentity")

Definition at line 8725 of file base_calculus.py.

Referenced by core.base_calculus.BinomialIdentity.expand(), and core.base_calculus.BinomialIdentity.into_str().

core::base_calculus.BinomialIdentity::kind [static]
Initial value:
property(get_kind,
                    doc="kind of BinomialIdentity it, " \
                + "e.g. 'sum_square'|'difference_square'|'squares_difference'"
                   )

Definition at line 8728 of file base_calculus.py.

Referenced by core.base_calculus.BinomialIdentity.expand(), and core.base_calculus.BinomialIdentity.into_str().


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