<jupyter_start><jupyter_text>Quadrature Rule：Using following approximation：  $$\int^1_0 f(x) dx \approx \frac{1}{90}[7f(0) + 32f(\frac{1}{4}) + 12f(\frac{1}{2}) + 32f(\frac{3}{4}) + 7f(1)]$$  Approximate：$\int^1_0 \frac{1}{x + 1} dx$<jupyter_code>from math import log
# define f(x) and the integral of f(x) = 1 / (x + 1)
def f(x):
    return 1 / (x^2 + 1)

def F(x):
    return log(x)
# approx
approx = (7 * f(0) + 32 * f(1 / 4) + 12 * f(1 / 2) + 32 * f(3 / 4) + 7 * f(1)) / 90
print("The approximation value is", approx)

# actual value
val = F(2) - F(1)
print("The actual value is", val)
error = abs(val - approx)
print("The error is", error)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21364985163204747, 'fraction_numerical': 0.07418397626112759, 'mean_word_length': 3.927007299270073, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '485277', 'license': 'MIT', 'n_tokens_mistral': 318, 'n_tokens_neox': 293, 'n_words': 78, 'path': 'sec5assignment04c.ipynb', 'repo_name': 'teshenglin/computational_mathematics', 'size': '674'}