```python
%pylab inline
```

    Populating the interactive namespace from numpy and matplotlib



```python
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import proj3d, Axes3D
from sympy import symbols, Matrix, solve
import math
from sympy.parsing.sympy_parser import parse_expr
```


```python
plt.figure(figsize=(10,10))
t = symbols('t')
u = parse_expr('Matrix([t*cos(3*t), t*sin(2*t)])')
a = 16
lim = [0, a]
ts = np.linspace(lim[0], lim[1], a**2)
Y = np.array([u.subs('t', t).evalf() for t in ts]).astype('float')
xs = [x[0] for x in Y]
ys = [x[1] for x in Y]
plot(xs, ys)
```


```python
t = symbols('t')
u = parse_expr('Matrix([t*cos(3*t), t*sin(2*t), t])')
a = 16
lim = [0, a]
ts = np.linspace(lim[0], lim[1], a**2)
Y = np.array([u.subs('t', t).evalf() for t in ts]).astype('float')
xs = [x[0] for x in Y]
ys = [x[1] for x in Y]
zs = [x[2] for x in Y]
fig = plt.figure(figsize=(10,10))
#plt.rcParams['savefig.dpi'] = 600
ax = fig.add_subplot(111, projection='3d')
plot(xs, ys, zs, c="purple")
plt.show()
```


```python
type(u)
```




    sympy.matrices.dense.MutableDenseMatrix




```python
u.shape
```




    (3, 1)




```python
def is_matrix_3x1(u): return 'Matrix' in str(type(u)) and u.shape == (3, 1)
def is_matrix_2x1(u): return 'Matrix' in str(type(u)) and u.shape == (2, 1)
```


```python
is_matrix_3x1(u)
```




    True




```python
is_matrix_2x1(u)
```




    False




```python
u.free_symbols
```




    {t}



# 1 var extremas


```python
x = symbols('x')
expr = parse_expr('-x**3 + 10*x**2 - x')
xs = np.linspace(-2, 10, 20)
ys = np.array([expr.subs('x', x).evalf() for x in xs]).astype('float')
plot(xs, ys)
```


```python
expr.diff('x')
```




    -3*x**2 + 20*x - 1




```python
expr_dx = expr.diff(x)
xs = np.linspace(-2, 10, 20)
ys = np.array([expr_dx.subs('x', x).evalf() for x in xs]).astype('float')
plot(xs, ys)
axhline(0, c='black', lw=1, ls='dashed')
cp = solve(expr_dx, 'x')
plot(cp, 'o')
```


```python

```

92d14b9b1524e7b65c2aa63aeba78ae29e570761
ipynb
Jupyter Notebook
Calcupy/Parametric curves.ipynb
darkeclipz/jupyter-notebooks
5de784244ad9db12cfacbbec3053b11f10456d7e
Unlicense
2018-08-28T12:16:12.000Z
2018-08-28T12:16:12.000Z
Calcupy/Parametric curves.ipynb
darkeclipz/jupyter-notebooks
5de784244ad9db12cfacbbec3053b11f10456d7e
Unlicense
Calcupy/Parametric curves.ipynb
darkeclipz/jupyter-notebooks
5de784244ad9db12cfacbbec3053b11f10456d7e
Unlicense
Qwen/Qwen-72B
1. YES
2. YES