We don't have support for that exact syntax, because it doesn't make
sense (with it, f is both a function and the evaluation of itself,
i.e., f == f(x)).  You could probably emulate it by writing a custom
class with minimal code, though.

If you want the more reasonable syntax f(x).diff(x), just define a
Python function

>>> def f(y):
...     return (100 - 2*x).subs(x, y)
...
>>> f(2)
96
>>> f(x).diff(x)
-2

lambdify is designed for efficient evaluation using numpy.  If you are
only evaulating at a couple of points, or you still want to use the
output with SymPy, just use a Python function.

For completeness, other options are implemented_function and
subclassing Function.  These are useful if you want the function to
remain unevaluated for some inputs. implemented_function is designed
to be used in conjunction with lambdify.  Subclassing Function lets
you write arbitrary code (in the eval method) to decide when the
function becomes evaluated or not (not evaluating means it is just
left as symbolic f(x)).

Aaron Meurer

On Mon, Jan 14, 2013 at 7:34 PM, Ben Lucato <[email protected]> wrote:
>> Thanks for your response. Is there a way to do this whilst preserving
>> other methods of functions. For example, so I can still do things like
>> f.diff()
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sympy/-/i0oibTlceh4J.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to