Your confusions here relate to Python's syntax.
simplify is defined by the keyword argument to the rref() function:
def rref(self, iszerofunc=_iszero, simplify=False, pivots=True,
normalize_last=True):
The default is False, unless the user specifies simplify=<something
else>, where <something else> should be a function.
Actually this code is not written in a very idiomatic way. The default
False implies that no simplification should happen, but this is not
the case. A better way to write this code would be
simpfunc = simplify or _simplify
with the function definition as
def rref(self, iszerofunc=_iszero, simplify=None, pivots=True,
normalize_last=True):
The isinstance(simplify, FunctionType) type check is not necessary.
> why simplify is imported as _simplify as well as nsimplify? I mean what is the need of both?
The simplify() function is imported as _simplify because otherwise it
would not be accessible in rref(), because the name "simplify" is
already used by the keyword argument.
nsimplify() is a separate function. The syntax
from sympy.simplify import simplify as _simplify, nsimplify
should be read as
from sympy.simplify import (simplify as _simplify), nsimplify # This
is not valid syntax, but this is how the precedence works
or equivalently,
from sympy.simplify import simplify as _simplify
from sympy.simplify import nsimplify
Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
sympy+un...@googlegroups.com.
> To post to this group, send email to
sy...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/sympy.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/8cf34aa0-bdaa-4fb3-a0b3-cdccfb731206%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.