Skip to content
Snippets Groups Projects
Commit 4e9d6f32 authored by Benjamin Berkels's avatar Benjamin Berkels
Browse files

added IPython notebook for Remark 1.5.1

parent 70d41905
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
### IPython notebook for Remark 1.5.1 from the lecture
%% Cell type:code id: tags:
``` python
import numpy as np
from IPython.display import display, Math
from sympy import Float, latex
def k(s, t, d):
return d / np.power(d ** 2 + (s - t) ** 2, 3 / 2)
d = 0.1
n = 80
h = 1 / n
display(Math(rf"n = {n},\; d = {d},\; h ={h}"))
s = (np.arange(n) + 0.5) * h
t = (np.arange(n) + 0.5) * h
display(Math(rf't_j=s_j=(j-\tfrac12)h,\; j=1,\ldots,{n}'))
A = h * k(s[:, np.newaxis], t[np.newaxis, :], d)
display(Math(r'A_{i,j}:=h \, k(s_i,t_j),\; k(s,t) := \frac{d}{(d^2 + (s-t)^2)^{3/2}}'))
```
%% Cell type:code id: tags:
``` python
eigvals = np.linalg.eig(A)[0]
lambda_max = np.amax(eigvals)
lambda_min = np.amin(eigvals)
cond_A = lambda_max / lambda_min
display(Math(r"\lambda_\text{max} = " + latex(Float(lambda_max, 4), max=1)))
display(Math(r"\lambda_\text{min} = " + latex(Float(lambda_min, 4))))
display(Math(r"\operatorname{cond(A)} = " + latex(Float(cond_A, 2))))
```
%% Cell type:code id: tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment