Vi har et vektorfelt

$$
\vec{F} = y \mathbf{i} + x \mathbf{j} + z \mathbf{k}
$$

Er vektorfeltet $\vec{F}$ konservativt?

Vi ser på kurveintegralet

$$
\int_{C_i} \vec{F} \cdot d\vec{r}
$$

mellom punktene $A=(0, 0, 0)$ og $B=(1,1,2)$, langs to forskjellige baner gitt ved 

$$
C_1 : \begin{cases} 
   x(t) = t \\
   y(t) = t  \\
   z(t) = 2t^2
   \end{cases},
   \quad \quad
C_2 : \begin{cases} 
   x(t) = t \\
   y(t) = t^2  \\
   z(t) = 2t
   \end{cases},
   \quad \quad t\in [0, 1].
$$

Dette tilsvarer posisjonsvektorene
$$
\vec{r_1} = t \mathbf{i} + t \mathbf{j} + 2t^2 \mathbf{k}, \quad \quad \vec{r_2} = t \mathbf{i} + t^2 \mathbf{j} + 2t \mathbf{k}, \quad \quad t\in [0, 1].
$$

Hvis $\int_{C_i} \vec{F} \cdot d\vec{r}$ er uavhengig av vei, så er vektorfeltet $\vec{F}$ konservativt.


```python
import numpy as np
import sympy as sp
from sympy.vector import CoordSys3D
t = sp.Symbol('t', real=True)
N = CoordSys3D('N')
```


```python
r1 = t*N.i + t*N.j + 2*t**2*N.k
r2 = t*N.i + t**2*N.j + 2*t*N.k
r1
```




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




```python
dr1dt = r1.diff(t, 1)
dr2dt = r2.diff(t, 1)
F = lambda r: r.dot(N.j)*N.i + r.dot(N.i)*N.j + r.dot(N.k)*N.k
```


```python
sp.Integral(F(r2).dot(dr2dt), (t, 1, 0)).doit()
```




$\displaystyle -3$




```python
%matplotlib notebook
from mpl_toolkits import mplot3d
import matplotlib.pyplot as plt
ax = plt.axes(projection='3d')
ti = np.linspace(0, 1, 100)
def plot(r, ti):
    ax.plot3D(sp.lambdify(t, r.dot(N.i))(ti),
              sp.lambdify(t, r.dot(N.j))(ti),
              sp.lambdify(t, r.dot(N.k))(ti))
plot(r1, ti)
plot(r2, ti)
```


    <IPython.core.display.Javascript object>







```python

```

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