Thanks, Aaron.  That works, though I had hoped for something prettier than:

Subs(Derivative(f(_x), _x), (_x,), (x0,))

It would be really great if sympy knew how to print this kind of thing
nicely (say, in an IPython notebook).

-David

On Wed, Jan 16, 2013 at 9:25 PM, Aaron Meurer <[email protected]> wrote:

> Try Subs(diff(f, x), x, x0).
>
> Note that mathematically, this should be the same as diff(f,
> x).subs(x, x0), because x is a bound (not free) variable in this
> expression, it doesn't matter if a different one is used, or if an
> expression is used that doesn't use it at all.  Note that if you use a
> non-variable instead of x0, it will automatically give you the Subs
> form (in particular, if you use a number, like diff(f, x).subs(x,
> 10)).  It will also give you the Subs form if you later substitute x0
> for a number (in terms of x0, but it doesn't matter because x0 serves
> as a dummy variable in this case).
>
> Aaron Meurer
>
> On Wed, Jan 16, 2013 at 5:06 AM, David Ketcheson <[email protected]> wrote:
> > Is there any way in sympy to express the derivative of an abstract
> function
> > evaluated at a point?  I can do
> >
> > import sympy
> > x,x0 = sympy.var(('x','x0'))
> > f=sympy.Function('f') (x)
> > sympy.diff(f)
> >
> > to get the derivative w.r.t. x evaluated at x.  If I do
> >
> > sympy.diff(f).subs(x,x0)
> >
> > then I get the derivative w.r.t. x0 evaluated at x0.  Can I get the
> > derivative w.r.t. x evaluated at x0?
> >
> > --
> > 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/-/cQScvWEPp9MJ.
> > 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.
>
>

-- 
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