Integrate function using Simpson’s rule in python

Опубликовано: 12 Декабрь 2021
на канале: SUPERSONIC P7R
1,387
17

#Given function
def f(x):
return 3*x**2
#Implementing Simpson's 1/3 rule
def simpson(x0,xn,n):
step size
h= (xn-x0)/n

finding sum
S=f(x0)+f(xn)
for i in range(1,n):
k = x0 + i*h
if i%2 == 0:
S = S + 2 * f(k)
else:
S = S+4 * f(k)
#Finding value
S = S * h/3
return S

a = float(input("Lower limit: "))
b = float(input("Upper limit: "))
n = int(input("number of sub intervals: "))
result = simpson(a , b, n)
print("Value is: %0.6f" % (result))


Can you code in python on an iPad?
Can I use iPad for coding?
Can I do python coding on iPad?
Is the iPad Pro good for coders?
Can python be installed on an iPad?

#pythontutorial
#pythonipadfree
#Pythonista
#pythonprogramming
#pythontutorial
#pythonforbeginners
#pythoncourse
#pythontutorial
#pythoncourse
#pythonprojects
#pythonbaba
#pythonautomation
#python_assignment


На этой странице сайта вы можете посмотреть видео онлайн Integrate function using Simpson’s rule in python длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь SUPERSONIC P7R 12 Декабрь 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,387 раз и оно понравилось 17 зрителям. Приятного просмотра!