{"cells":[{"cell_type":"text","text":"

SymPy: Open Source Symbolic Mathematics

"},{"code":"%load_ext sympyprinting","cell_type":"code","prompt_number":1},{"code":"from __future__ import division\nfrom sympy import *\nx, y, z = symbols(\"x y z\")\nk, m, n = symbols(\"k m n\", integer=True)\nf, g, h = map(Function, 'fgh')","cell_type":"code","prompt_number":2},{"cell_type":"text","text":"

Elementary operations

"},{"code":"Rational(3,2)*pi + exp(I*x) / (x**2 + y)\n","cell_type":"code","prompt_number":3},{"code":"exp(I*x).subs(x,pi).evalf()\n","cell_type":"code","prompt_number":4},{"code":"e = x + 2*y","cell_type":"code","prompt_number":5},{"code":"srepr(e)","cell_type":"code","prompt_number":6},{"code":"exp(pi * sqrt(163)).evalf(50)","cell_type":"code","prompt_number":7},{"cell_type":"text","text":"

Algebra

"},{"code":"((x+y)**2 * (x+1)).expand()","cell_type":"code","prompt_number":8},{"code":"a = 1/x + (x*sin(x) - 1)/x\ndisplay(a)\nsimplify(a)","cell_type":"code","prompt_number":9},{"code":"solve(Eq(x**3 + 2*x**2 + 4*x + 8, 0), x)","cell_type":"code","prompt_number":10},{"code":"a, b = symbols('a b')\nSum(6*n**2 + 2**n, (n, a, b))","cell_type":"code","prompt_number":11},{"cell_type":"text","text":"

Calculus

"},{"code":"limit((sin(x)-x)/x**3, x, 0)","cell_type":"code","prompt_number":12},{"code":"(1/cos(x)).series(x, 0, 6)","cell_type":"code","prompt_number":13},{"code":"diff(cos(x**2)**2 / (1+x), x)","cell_type":"code","prompt_number":14},{"code":"integrate(x**2 * cos(x), (x, 0, pi/2))","cell_type":"code","prompt_number":15},{"code":"eqn = Eq(Derivative(f(x),x,x) + 9*f(x), 1)\ndisplay(eqn)\ndsolve(eqn, f(x))","cell_type":"code","prompt_number":16},{"code":"%notebook save sympy.ipynb","cell_type":"code","prompt_number":40},{"code":"%notebook load basic_quantum.ipynb","cell_type":"code","prompt_number":41}]}