```
%matplotlib inline
from IPython.display import display
from sympy import *
from sympy.abc import x, a, n
k = Symbol("k", positive=True, integer=True)
init_printing()
```


```
n = 6
tj = [2*pi*j/n for j in range(n)]
display(tj)
```


$$\begin{bmatrix}0, & \frac{\pi}{3}, & \frac{2 \pi}{3}, & \pi, & \frac{4 \pi}{3}, & \frac{5 \pi}{3}\end{bmatrix}$$



```
fj = [expand((t - pi)*t*(t-2*pi)) for t in tj]
display(fj)
```


$$\begin{bmatrix}0, & \frac{10 \pi^{3}}{27}, & \frac{8 \pi^{3}}{27}, & 0, & - \frac{8 \pi^{3}}{27}, & - \frac{10 \pi^{3}}{27}\end{bmatrix}$$



```
ak = [2/n * sum([fj[j]*cos(k*tj[j]) for j in range(n)]) for k in range(4)]
display(ak)
```


$$\begin{bmatrix}0, & 0, & 0, & 0\end{bmatrix}$$



```
zk = [[simplify(fj[j]*sin(k*tj[j])) for j in range(n)] for k in range(1, 4)]
display(zk)
bk = [nsimplify(2/n * sum(zk[k])) for k in range(0, 3)]
display(bk)
```


$$\begin{bmatrix}\begin{bmatrix}0, & \frac{5 \sqrt{3}}{27} \pi^{3}, & \frac{4 \sqrt{3}}{27} \pi^{3}, & 0, & \frac{4 \sqrt{3}}{27} \pi^{3}, & \frac{5 \sqrt{3}}{27} \pi^{3}\end{bmatrix}, & \begin{bmatrix}0, & \frac{5 \sqrt{3}}{27} \pi^{3}, & - \frac{4 \sqrt{3}}{27} \pi^{3}, & 0, & - \frac{4 \sqrt{3}}{27} \pi^{3}, & \frac{5 \sqrt{3}}{27} \pi^{3}\end{bmatrix}, & \begin{bmatrix}0, & 0, & 0, & 0, & 0, & 0\end{bmatrix}\end{bmatrix}$$



$$\begin{bmatrix}\frac{2 \sqrt{3}}{9} \pi^{3}, & \frac{2 \sqrt{3}}{81} \pi^{3}, & 0\end{bmatrix}$$



```
plot1 = plot((x-pi)*x*(x-2*pi),(x, 0, 2*pi), show=False)
plot1.extend(plot(bk[0]*sin(x)+bk[1]*sin(2*x), (x, 0, 2*pi), show=False, line_color='r'))
plot1.extend(plot(bk[0]*sin(x), (x, 0, 2*pi), show=False, line_color='g'))
plot1.extend(plot(bk[1]*sin(2*x), (x, 0, 2*pi), show=False, line_color='y'))
plot1.show()
```


```
simplify(integrate(1/pi * x * (x-pi) * (x-2*pi) * cos(k*x), (x, 0, 2*pi)))
```


```
simplify(integrate(1/pi * x * (x-pi) * (x-2*pi) * sin(k*x), (x, 0, 2*pi)))
```


```
[N(bk[j]) for j in range(3)]
```




$$\begin{bmatrix}11.9343214586261, & 1.32603571762512, & 0\end{bmatrix}$$




```
[12/(j**3) for j in range(1, 4)]
```




$$\begin{bmatrix}12.0, & 1.5, & 0.4444444444444444\end{bmatrix}$$



caa622776a3e73d680d12fc53ace120f12546661
ipynb
Jupyter Notebook
Aufgabe 23).ipynb
bschwb/Numerik
dcd178847104c382474142eae3365b6df76d8dbf
MIT
Aufgabe 23).ipynb
bschwb/Numerik
dcd178847104c382474142eae3365b6df76d8dbf
MIT
Aufgabe 23).ipynb
bschwb/Numerik
dcd178847104c382474142eae3365b6df76d8dbf
MIT
Qwen/Qwen-72B
1. YES
2. YES