You can also use the .diff() method, like

In [52]: tan(x).diff(x)
Out[52]: 
      2   
1 + tan (x)

In [53]: (x + sin(x)).diff(x)
Out[53]: 1 + cos(x)


Aaron Meurer

On Mar 21, 2011, at 8:49 AM, Alexey U. Gudchenko wrote:

> 21.03.2011 16:28, Kit пишет:
>> How do I perform a symbolic differentiation in sympy? I did a search in the
>> online documentation but I only found Numerical 
>> Derivatives<http://docs.sympy.org/dev/modules/mpmath/calculus/differentiation.html?highlight=derivative>,
>> which requires explicit values for the variables. I would like
>> differentiation that outputs symbolic variables. Here's a very simple
>> example:
>> 
>> <https://lh4.googleusercontent.com/_SWc09U3SrBE/TYdSS1NlMyI/AAAAAAAAACI/qvifCKiP_xY/derivative.png>
>> 
> 
> Hi,
> 
> As I understand, symbolic differentiation present in sympy for expressions, 
> See:
> 
>   http://docs.sympy.org/dev/tutorial.html#differentiation
> 
>>>> from sympy import *
>>>> x = Symbol('x')
>>>> diff(sin(x), x)
>   cos(x)
>>>> diff(sin(2*x), x)
>   2*cos(2*x)
> 
>>>> diff(tan(x), x)
>   1 + tan(x)**2
> 
> Though for functions there are some open issues:
> 
>   http://code.google.com/p/sympy/issues/detail?id=1620
>   http://code.google.com/p/sympy/issues/detail?id=1660
> 
> and so on.
> 
> And pulls, in which someone processing about it
> 
>   https://github.com/sympy/sympy/pull/134
> 
> 
> But at the same time these issues seems to be related with function 
> architecture.
> 
>   http://code.google.com/p/sympy/issues/detail?id=1688
> 
> 
> -- 
> Alexey U.
> 
> -- 
> 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