Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- import numpy as np
- from matplotlib import mlab
- import pylab
- factorial = 1.0
- sign = 1.0
- x = 0.0
- result = 0.0
- x = math.pi/2
- n = 1
- n = input ()
- slave = 1.0
- fact = 1.0
- term = x
- for i in range (1,n):
- result = result + term
- sign = sign * (-1)
- slave = slave + 2.0
- fact = fact * (slave - 1) * slave
- term = term * x * x * sign / (1.0*fact)
- print result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement