smpl.wrap¶
Simplified wrapping.
Submodules¶
Package Contents¶
Functions¶
|
Returns a lambda of given |
|
|
|
Return a latex string for passed function. |
|
Returns a list of variables used in the |
- smpl.wrap.get_lambda(expr, xvar)[source]¶
Returns a lambda of given
str/function/lambdaexpression with__doc__set to the latex expression.xvaris moved to the front.Examples¶
>>> l = get_lambda(lambda a,b,c,x : (a+b+c)*x,'x') >>> l(4,1,1,1) 12 >>> l = get_lambda("(a+b+c)*x",'x') >>> l(4,1,1,1) 12 >>> def fun(a,b,x,c): ... return (a+b+c)*x >>> l = get_lambda(fun,'x') >>> l(4,1,1,1) 12
- smpl.wrap.get_latex(function)[source]¶
Return a latex string for passed function.
Parameters¶
- functionfunction_like
function as str lambda or (oneline) function
Examples¶
>>> get_latex(lambda a,b,c,x : (a+b+c)*x,) '$x \\left(a + b + c\\right)$' >>> get_latex("(a+b+c)*x") '$x \\left(a + b + c\\right)$' >>> def fun(a,b,x,c): ... return (a+b+c)*x >>> get_latex(fun) '$x \\left(a + b + c\\right)$'