Package SloppyCell :: Package ExprManip :: Module Simplify
[hide private]

Module Simplify

source code

Functions for simplifying python math expressions.

Functions [hide private]
Return a simplified version of the expression.
source code
Return a simplified ast.
source code
Variables [hide private]
  _ZERO = Const(0)
  _ONE = Const(1)

Imports: Slice, Const, Raise, For, AssTuple, Mul, Invert, RightShift, AssList, Add, Dict, flatten, UnaryAdd, Import, Print, Ellipsis, Sliceobj, Decorators, Subscript, Name, Node, Assert, Return, Power, Exec, CO_VARKEYWORDS, GenExprFor, Stmt, Or, Break, CO_VARARGS, Bitand, FloorDiv, Tuple, Bitxor, TryExcept, Not, nodes, EmptyNode, With, Class, Mod, Printnl, Function, TryFinally, GenExprIf, While, AssAttr, Keyword, GenExpr, Module, AugAssign, List, Yield, IfExp, AssName, From, Continue, Backquote, Discard, Div, Expression, Assign, Lambda, And, LeftShift, Compare, GenExprInner, CallFunc, Global, Getattr, ListCompIf, Sub, ListCompFor, flatten_nodes, Pass, UnarySub, Bitor, ListComp, If, operator, sets, AST

Function Details [hide private]


source code 

Return a simplified ast.

Current simplifications:
    Special cases for zeros and ones, and combining of constants, in 
        addition, subtraction, multiplication, division.
    Note that at present we only handle constants applied left to right.
      1+1+x -> 2+x, but x+1+1 -> x+1+1.
    x - x = 0
    --x = x