<jupyter_start><jupyter_text>Gegeben ist das Randwertproblem\begin{eqnarray}    -u''(x) + u(x) = 1 & \qquad \text{für} \; x \in (0,1)\\    u(0) = 0\\    u'(1) = 1\end{eqnarray}<jupyter_code>x0 = 0
xend = 1
u0 = 0
udot_end = 1
f = 1
def mat_f(i, j):
    i += 1
    j += 1
    return i * j / (i+j-1) + 1 / (i+j+1)
def p_FEM(p, xi):
    base_matrix = np.fromfunction(np.vectorize(mat_f), (p, p))

    rhs_list = [1/(i+1) + udot_end for i in range(1, p+1)]
    rhs = np.array(rhs_list)

    up_coeff = np.linalg.solve(base_matrix, rhs)
    up_coeff = np.hstack((np.array([u0]), up_coeff))
    
    up = 0
    for j, coeff in enumerate(up_coeff):
        up += coeff * xi**j
        
    return up
h = 0.01
xi = np.arange(0, 1+h, h)
for p in range(0,5):
    plt.plot(p_FEM(2**p, xi))
    
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18810679611650485, 'fraction_numerical': 0.04004854368932039, 'mean_word_length': 2.650442477876106, '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': '136948', 'license': 'MIT', 'n_tokens_mistral': 408, 'n_tokens_neox': 393, 'n_words': 86, 'path': 'ueb10/ex42.ipynb', 'repo_name': 'BerndSchwarzenbacher/numdiff', 'size': '824'}