Module Differentiation
source code
|
load_derivs(filename)
Load up a pickled dictionary of saved derivatives. |
source code
|
|
|
|
|
diff_expr(expr,
wrt)
Return the derivative of the expression with respect to a given variable. |
source code
|
|
|
_diff_ast(ast,
wrt)
Return an AST that is the derivative of ast with respect the variable with
name 'wrt'. |
source code
|
|
|
_product_deriv(terms,
wrt)
Return an AST expressing the derivative of the product of all the terms. |
source code
|
|
|
logger = logging.getLogger('ExprManip.Differentiation')
|
|
_ZERO = Const(0)
|
|
_ONE = Const(1)
|
|
__deriv_saved = {}
|
|
_KNOWN_FUNCS = {('acos', 1):('1/sqrt(1-arg0**2)',), ('asin', 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,
copy,
cPickle,
logging,
os,
AST,
strip_parse,
Simplify,
Substitution
_KNOWN_FUNCS
- Value:
{('acos', 1):('1/sqrt(1-arg0**2)',), ('asin', 1):('1/sqrt(1-arg0**2)',
), ('atan', 1):('1/(1+arg0**2)',), ('cos', 1):('-sin(arg0)',), ('cosh'
, 1):('sinh(arg0)',), ('exp', 1):('exp(arg0)',), ('log', 1):('1/arg0',
), ('log10', 1):('1/(log(10)*arg0)',), ('sin', 1):('cos(arg0)',), ('si
nh', 1):('cosh(arg0)',), ('arcsinh', 1):('1/sqrt(1+arg0**2)',), ('arcc
osh', 1):('1/sqrt(arg0**2 - 1.)',), ('arctanh', 1):('1/(1.-arg0**2)',)
, ('sqrt', 1):('1/(2*sqrt(arg0))',), ('tan', 1):('1/cos(arg0)**2',), (
'tanh', 1):('1/cosh(arg0)**2',), ('pow', 2):('arg1 * arg0**(arg1-1)',
...
|
|