CoCalc Public Files201-303-AH / Fichiers Sage pour les Étudiants / Exercice 11 p 213.sagewsOpen with one click!
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)
(x,y)  x3+3xy23x\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() show(gradf)
(x,y)  (3x2+3y23,6xy)\displaystyle \left( x, y \right) \ {\mapsto} \ \left(3 \, x^{2} + 3 \, y^{2} - 3,\,6 \, x y\right)
eq1 = gradf[0](x,y) == 0 eq2 = gradf[1](x,y) == 0 show(eq1) show(eq2)
3x2+3y23=0\displaystyle 3 \, x^{2} + 3 \, y^{2} - 3 = 0
6xy=0\displaystyle 6 \, x y = 0
pcrit = solve([eq1, eq2], (x,y)) show(pcrit)
[[x=(1)\displaystyle x = \left(-1\right), y=0\displaystyle y = 0], [x=1\displaystyle x = 1, y=0\displaystyle y = 0], [x=0\displaystyle x = 0, y=(1)\displaystyle y = \left(-1\right)], [x=0\displaystyle x = 0, y=1\displaystyle y = 1]]
hessf = f.hessian() show(hessf(x,y))
(6x6y6y6x)\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