pystencils.sympyextensions.math.fast_subs

Contents

pystencils.sympyextensions.math.fast_subs#

pystencils.sympyextensions.math.fast_subs(expression, substitutions, skip=None)#

Similar to sympy subs function.

Parameters:
  • expression (TypeVar(T)) – expression where parts should be substituted

  • substitutions (Dict) – dict defining substitutions by mapping from old to new terms

  • skip (Optional[Callable[[Expr], bool]]) – function that marks expressions to be skipped (if True is returned) - that means that in these skipped expressions no substitutions are done

Return type:

TypeVar(T)

This version is much faster for big substitution dictionaries than sympy version