PHYS341, F2019, Day #2

IPython Notebook to visualize a surface. We use the example:
\begin{equation} 
z = x^2 + y^2
\end{equation}


```python
%matplotlib notebook
import numpy as np
from mpl_toolkits.mplot3d import Axes3D  
# Axes3D import adds feature, it enables using projection='3d' in add_subplot
import matplotlib.pyplot as plt
import random

def fun(x, y):
    return x**2 + y**2

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = y = np.arange(-3.0, 3.0, 0.05)
X, Y = np.meshgrid(x, y)
zs = np.array(fun(np.ravel(X), np.ravel(Y)))
Z = zs.reshape(X.shape)

ax.plot_surface(X, Y, Z)

ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')

plt.show()
```


```python

```

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