# Plotting


```python
from IPython.display import Latex
from matplotlib.pyplot import *
from numpy import *
from sympy import latex, simplify, solve, symbols
```


```python
x = symbols("x")
X = linspace(-4, 4.05, 128)
F = [x**2, x + 4]
s = r'$$\begin{align}' + '\n'
for i, f in enumerate(F):
    s += f"f_{i+1}={latex(F[i])}." + '\n' + (r'\\' if len(F) > i+1 else r'\end{align}$$')
Latex(s)
```




$$\begin{align}
f_1=x^{2}.
\\f_2=x + 4.
\end{align}$$




```python
xlabel("$x$")
ylabel("$y$")
grid(True)
axis('equal')
axis([-5, 5, 0, 16])
axis(False)
labels = list()
for f in F:
    Y = [f.evalf(subs={x:x0}) for x0 in X]
    labels.append(f"${latex(f)}$")
    plot(X,Y)
legend(labels=labels)
S = solve(F[0]-F[1])
for i in range(len(S)):
    annotate(rf"$\left({latex(S[i])}, {latex(F[i].subs({x:S[i]}))}\right)$",
             xy=(S[i].evalf(), F[i].evalf(subs={x:S[i]})))
Latex(f'$$S={latex(S)}.$$')
```




$$S=\left[ \frac{1}{2} - \frac{\sqrt{17}}{2}, \  \frac{1}{2} + \frac{\sqrt{17}}{2}\right].$$




```python
show()
```


```python
public(plt)
```


```python

```

b9bed88450b7448b2056c306d5ffc53e9a328f92
ipynb
Jupyter Notebook
gcv/notes/plotting.ipynb
fuzzyklein/gcv-lab
9d2c552b8226350dd6f4d5c38a42d1b90d3c3ca7
MIT
gcv/notes/plotting.ipynb
fuzzyklein/gcv-lab
9d2c552b8226350dd6f4d5c38a42d1b90d3c3ca7
MIT
gcv/notes/plotting.ipynb
fuzzyklein/gcv-lab
9d2c552b8226350dd6f4d5c38a42d1b90d3c3ca7
MIT
Qwen/Qwen-72B
1. YES
2. YES