# coding: utf-8 # In[1]: from sympy import * E**(I*pi)+1 # In[4]: x = Symbol('x') expand( E**(I*x) ) # In[6]: x = Symbol("x", real=True) expand(exp(I*x), complex=True) # In[7]: tmp = series(exp(I*x), x, 0, 10) pprint(tmp) # In[8]: pprint(re(tmp)) # In[9]: pprint( series( cos(x), x, 0, 10) ) # In[10]: pprint(series(sin(x), x, 0, 10)) # In[11]: integrate(x*sin(x), x) # In[12]: integrate(x*sin(x), (x, 0, 2*pi)) # In[13]: x, y, r = symbols('x,y,r') 2 * integrate(sqrt(r*r-x**2), (x, -r, r)) # In[18]: r = symbols('r', positive=True) circle_area = 2 * integrate(sqrt(r**2-x**2), (x, -r, r)) circle_area # In[17]: r = symbols('r', positive=True) circle_area = circle_area.subs(r, sqrt(r**2-x**2)) circle_area # In[21]: r = symbols('r', positive=True) circle_area = circle_area.subs(r, sqrt(r**2-x**2)) integrate(circle_area, (x, -r, r)) # In[ ]: