# Kurveintegral med Sympy

Vi har en kurve i rommet

$$
\vec{r}(t) = t\mathbf{i} + t\mathbf{j} + 2t^{3/2} \mathbf{k}, \quad t \in [0, 1]
$$


```python
import numpy as np
import sympy as sp
import matplotlib.pyplot as plt
from sympy.vector import CoordSys3D
```

Start med å plotte kurven i 3D rom. Dette kan man gjøre med matplotlib på følgende måte.


```python
%matplotlib notebook
ax = plt.axes(projection='3d')
ti = np.linspace(0, 1, 100)
ax.plot3D(ti, ti, 2*ti**1.5)
```


    <IPython.core.display.Javascript object>









    [<mpl_toolkits.mplot3d.art3d.Line3D at 0x7f839062b820>]



Lag et koordinatsystem og posisjonsvektoren $\vec{r}$


```python
t = sp.Symbol('t', real=True)
N = CoordSys3D('N')
r = t*N.i + t*N.j + 2*t**sp.Rational(3,2)*N.k
```

Finn så den deriverte av $\vec{r}$ mhp t


```python
drdt = r.diff(t, 1)
drdt
```




$\displaystyle \mathbf{\hat{i}_{N}} + \mathbf{\hat{j}_{N}} + (3 \sqrt{t})\mathbf{\hat{k}_{N}}$



Integrer for å finne buelengden


```python
sp.integrate(sp.sqrt(drdt.dot(drdt)), (t, 0, 1))
```




$\displaystyle - \frac{4 \sqrt{2}}{27} + \frac{22 \sqrt{11}}{27}$



96c4bd2e5b7986691481a284623ae1caac5c9ea3
ipynb
Jupyter Notebook
notebooks/Kurveintegral.ipynb
mikaem/MEK1100-22
cddd990347d14983ffc61305182a1810f8af9367
BSD-2-Clause
2022-01-19T23:27:44.000Z
2022-02-07T12:59:47.000Z
notebooks/Kurveintegral.ipynb
mikaem/MEK1100-22
cddd990347d14983ffc61305182a1810f8af9367
BSD-2-Clause
notebooks/Kurveintegral.ipynb
mikaem/MEK1100-22
cddd990347d14983ffc61305182a1810f8af9367
BSD-2-Clause
Qwen/Qwen-72B
1. YES
2. YES