Skip to content

Instantly share code, notes, and snippets.

@Sinitca-Aleksandr
Created February 3, 2016 11:08
Show Gist options
  • Select an option

  • Save Sinitca-Aleksandr/7cbebd04a5a6c07e4662 to your computer and use it in GitHub Desktop.

Select an option

Save Sinitca-Aleksandr/7cbebd04a5a6c07e4662 to your computer and use it in GitHub Desktop.
>>> from sympy import *
>>> x = Symbol('x')
>>> diff(sin(x**2), x)
2*x*cos(x**2)
# Найдем вторую производную "в лоб"
>>> diff(diff(sin(x**2), x),x)
-4*x**2*sin(x**2) + 2*cos(x**2)
# Найдем вторую и далее производные простым способом
>>> diff(cos(2*x**2), x, 1)
-4*x*sin(2*x**2)
>>> diff(cos(2*x**2), x, 2)
-4*(4*x**2*cos(2*x**2) + sin(2*x**2))
>>> diff(cos(2*x**2), x, 10)
1024*(-1024*x**10*cos(2*x**2) - 11520*x**8*sin(2*x**2) + 40320*x**6*cos(2*x**2) + 50400*x**4*sin(2*x**2) - 18900*x**2*cos(2*x**2) - 945*sin(2*x**2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment