<jupyter_start><jupyter_text><jupyter_code>from math import sin
def f(x): return 0.2+(25*x)-(200*x**2)+(675*x**3)-(900*x**4)+(400*x**5)   #define the function

a = 0
b = 0.8
n = 0.2
h = (b-a)/n   #width of the trapezoid
S = h* (f(a)+f(b))    #beginning value of summation
for i in range(1,n):
    S+=f(a+i*h)
Integral = h*S
print('Integral = %.1f' %Integral)

#does not work because the value of n is considered float and does not work with for loop
from math import sin
def f(x): return 0.2+(25*x)-(200*x**2)+(675*x**3)-(900*x**4)+(400*x**5)   #define the function

a = 0
b = 0.8
n = 999
h = (b-a)/n   #width of the trapezoid
S = h* (f(a)+f(b))    #beginning value of summation
for i in range(1,n):
    S+=f(a+i*h)
Integral = h*S
print('Integral = %.1f' %Integral)

#the closest that i got is with the n = 999<jupyter_output>Integral = 1.6
{'fraction_non_alphanumeric': 0.19047619047619047, 'fraction_numerical': 0.07142857142857142, 'mean_word_length': 4.0359281437125745, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '620675', 'license': 'Apache-2.0', 'n_tokens_mistral': 409, 'n_tokens_neox': 362, 'n_words': 109, 'path': 'Villasor_Recitation.ipynb', 'repo_name': 'vincev16/Numerical-Methods-58011', 'size': '840'}