```python
%matplotlib notebook
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
```

Plot the vector function:
\begin{equation}
\vec{F}(x,y) = y^2 \hat{x} + x^2\hat{y}
\end{equation}


```python
fig = plt.figure()
ax = fig.gca()

x, y = np.meshgrid(np.arange(-1, 1.2, 0.2),
                      np.arange(-1, 1.2, 0.2))

u = y**2
v = x**2 
w = 0
ax.quiver(x, y, u, v, scale=5)
plt.show()
ax.set_xlabel('X');
ax.set_ylabel('Y');
```


    <IPython.core.display.Javascript object>






# Questions:
1) What is the direction of the curl?

2) Does the magnitude change signs?

3) Plot the magnitude (including sign).

### As a demonstration use *sympy* to evaluate the curl (even though we can easily do it by hand)


```python
from sympy.physics.vector import ReferenceFrame
from sympy.physics.vector import curl
R = ReferenceFrame('R')

F = R[1]**2 * R.x + R[0]**2 * R.y
print('The vector field:')
print(F)
G = curl(F, R)  
print('\n')
print('The curl of the vector field')
print(G)
```

    The vector field:
    R_y**2*R.x + R_x**2*R.y
    
    
    The curl of the vector field
    (2*R_x - 2*R_y)*R.z



```python
# Numerically evaluate the curl 
u = 0
v = 0
w = 2*x - 2*y
```


```python
fig = plt.figure()
ax = fig.gca()
im = ax.imshow(np.flipud(w), extent=[-1,1,-1,1])
fig.colorbar(im)
fig.suptitle('The magnitude of the curl')
ax.set_xlabel('X');
ax.set_ylabel('Y');
```


    <IPython.core.display.Javascript object>






a32523bedbecc31933347e02726b23dbae660140
ipynb
Jupyter Notebook
curl2.ipynb
lucask07/teaching-notebooks
732638b3bac528f85e0dc649c4671c005f58b22b
MIT
curl2.ipynb
lucask07/teaching-notebooks
732638b3bac528f85e0dc649c4671c005f58b22b
MIT
curl2.ipynb
lucask07/teaching-notebooks
732638b3bac528f85e0dc649c4671c005f58b22b
MIT
Qwen/Qwen-72B
1. YES
2. YES