import sympy,numpy
print "Indefinite integral"
x = sympy.Symbol('x')
f = sympy.integrate((sympy.sin(x))**4,(x))
print f
import sympy,numpy
print "Indefinite integral"
x = sympy.Symbol('x')
f = sympy.integrate((sympy.cos(x))**7,(x))
print f
import sympy,numpy,math
print "Definite integral"
x = sympy.Symbol('x')
f = sympy.integrate((sympy.cos(x))**6,(x,0,math.pi/2))
print float(f)
import sympy,numpy,math
print "Definite integral"
x = sympy.Symbol('x')
a = sympy.Symbol('a')
g = x**7/(a**2-x**2)**1/2
f = sympy.integrate(g,(x,0,a))
print f
import sympy,numpy,math
print "Definite integral"
x = sympy.Symbol('x')
a = sympy.Symbol('a')
g = x**3*(2*a*x-x**2)**(1/2)
f = sympy.integrate(g,(x,0,2*a))
print f
from sympy.abc import x,a,n
from sympy.integrals import Integral
print "Definite integral"
g = 1./(a**2+x**2)**n
f = Integral(g,(x,0,1))
print f.as_sum(2).n()
from sympy.abc import x,a,n
from sympy.integrals import Integral
import sympy, math
print "Definite integral"
g = (sympy.sin(6*x))**3*(sympy.cos(3*x))**7
f = Integral(g,(x,0,math.pi/6))
print f.as_sum(2).n()
import sympy,numpy,math
print "Definite integral"
x = sympy.Symbol('x')
g = (sympy.sin(6*x))**3*(sympy.cos(3*x))**7
g = x**4*(1-x**2)**(3/2)
f = sympy.integrate(g,(x,0,1))
print float(f)
import sympy,numpy,math
print "Definite integral"
x = sympy.Symbol('x')
m = sympy.Symbol('m')
n = sympy.Symbol('n')
n = int(raw_input("Enter n : "))
m = int(raw_input("Enter m : "))
g =(sympy.cos(x))**m*sympy.cos(n*x)
f = sympy.integrate(g,(x,0,math.pi/2))
print float(f)
g2 =(sympy.cos(x))**(m-1)*sympy.cos((n-1)*x)
f2 = m/(m+n)*sympy.integrate(g2,(x,0,math.pi/2))
print float(f2)
print "Equal"
import sympy,numpy,math
print "Definite integral"
x = sympy.Symbol('x')
a = sympy.Symbol('a')
n = int(raw_input("Enter n : "))
g = sympy.exp(a*x)*(sympy.sin(x))**n
f = sympy.integrate(g,(x))
print f
import sympy,numpy,math
x = sympy.Symbol('x')
print sympy.integrate(sympy.tan(x)**5,(x))
import numpy,sympy,math
n = int(raw_input("Enter the value of n : "))
p = sympy.integrate((sympy.tan(x))**(n-1),('x',0,math.pi/4))
q = sympy.integrate((sympy.tan(x))**(n+1),('x',0,math.pi/4))
print "n(p+q)= ",
print n*(p+q)
import sympy,numpy,math
x = sympy.Symbol('x')
g = sympy.sec(x)**4
print sympy.integrate(g,('x',0,math.pi/4))
import sympy,numpy,math
x = sympy.Symbol('x')
print sympy.integrate('1/sin(x)**3',('x',math.pi/3,math.pi/2))
import sympy,math
from sympy.abc import x
from sympy.integrals import Integral
import sympy, math
g = x*sympy.sin(x)**6*sympy.cos(x)**4
f = Integral(g,(x,0,math.pi/6))
print float(f)
import sympy,math
from sympy.abc import x
from sympy.integrals import Integral
x = sympy.Symbol('x')
a = math.pi/2
f = (sympy.sin(x)**0.5)/(sympy.sin(x)**0.5+sympy.cos(x)**0.5)
f = Integral(f,(x, 0, a))
print float(f)
import sympy,numpy,math
x = sympy.Symbol('x')
print "The summation is equivalent to integration of 1/(1+xˆ2) from 0 to 1"
g = 1/(1+x**2)
f = sympy.integrate(g,(x,0,1))
print float(f)
import sympy,numpy,math
x = sympy.Symbol('x')
print "The summation is equivalent to integration of log(1+x) from 0 to 1"
g = sympy.log(1+x)
f = sympy.integrate(g,(x,0,1))
print float(f)
import sympy,math
from sympy.integrals import Integral
f = Integral(x*sympy.sin(x)**8*sympy.cos(x)**4,(x,0,math.pi))
print float(f)
import numpy,sympy,math
from sympy.integrals import Integral
x = sympy.Symbol('x')
#f = sympy.integrate(sympy.log(sympy.sin(x)),('x',0,math.pi/2))
f = Integral(sympy.log(sympy.sin(x)), (x, 0, 1.5707963267949))
print float(f)
%matplotlib inline
import matplotlib.pyplot as plt
import numpy
import math
x = numpy.linspace(-5,10,70)
y1 = (x+8)/2
y2 = x**2/8
plt.xlabel('X axis')
plt.ylabel('Y axis')
plt.title('My Graph')
plt.plot(x, y1, "o-" )
plt.plot(x, y2, "+-" )
plt.legend(["(x+8)/2","x**2/8"])
print "from the graph, it is clear that the points of intersection are x=−4 and x =8."
print "So, our region of integration is from x=−4 to x=8"
print sympy.integrate('(x+8)/2-x**2/8',('x',-4,8))