CoCalc Public Files201-303-AH / Fichiers Sage pour les Étudiants / Exercice 11 p 213.sagews
Author: Julien Giol
Description: Fichiers Sage
Compute Environment: Ubuntu 18.04 (Deprecated)
var('x, y')
f(x,y) = x^3-3*x+3*x*y^2
show(f)

(x, y)
$\displaystyle \left( x, y \right) \ {\mapsto} \ x^{3} + 3 \, x y^{2} - 3 \, x$
%md
# Recherche des points critiques et des valeurs extrêmes


# Recherche des points critiques et des valeurs extrêmes

gradf = f.gradient()

$\displaystyle \left( x, y \right) \ {\mapsto} \ \left(3 \, x^{2} + 3 \, y^{2} - 3,\,6 \, x y\right)$
eq1 = gradf[0](x,y) == 0
show(eq1)
show(eq2)

$\displaystyle 3 \, x^{2} + 3 \, y^{2} - 3 = 0$
$\displaystyle 6 \, x y = 0$
pcrit = solve([eq1, eq2], (x,y))
show(pcrit)

[[$\displaystyle x = \left(-1\right)$, $\displaystyle y = 0$], [$\displaystyle x = 1$, $\displaystyle y = 0$], [$\displaystyle x = 0$, $\displaystyle y = \left(-1\right)$], [$\displaystyle x = 0$, $\displaystyle y = 1$]]
hessf = f.hessian()
show(hessf(x,y))

$\displaystyle \left(\begin{array}{rr} 6 \, x & 6 \, y \\ 6 \, y & 6 \, x \end{array}\right)$
%md
# Graphique


# Graphique

r = 2
G = plot3d(f(x,y), (x, -r, r), (y, -r, r), plot_points=15, color='orange', mesh=1, opacity=.7)
p = 10
G += points((1,0),  color='red', pointsize=p)
G += points((-1,0),  color='blue', pointsize=p)
G += points((0,-1),  color='green', pointsize=p)
G += points((0,1),  color='green', pointsize=p)
show(G)

3D rendering not yet implemented
show(G, aspect_ratio=[5, 5, 1])

3D rendering not yet implemented