On Sat, Jan 3, 2015 at 1:03 PM, Aaron Meurer <[email protected]> wrote: > If you always want to evaluate to a given expression, then there is no point > in using a Function subclass over a Python function. > > In your example, f(x) is nothing more than a shortcut for x**2. fx = f(x) is > semantically equivalent to fx = x**2. > > The point of Function is that it can be unevaluated. This is useful because > sometimes you don't have an evaluation (like sin(x) or sin(1) should both > stay as-is), and also because it lets you simplify expressions so that they > are in terms of a single function, rather than a large expression (Python > functions always evaluate eagerly, so there is no way to use f(x) in an > expression with your example; it will always be replaced with x**2 as soon > as it is evaluated).
Thanks a lot for the explanation. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CANODV3ncSav4o3azmmi9ypHvKFRfKJJAAs6urz2Vd5bX2_4F2w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
