Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Quelques notebooks SAGE / Python. Équations différentielles ou calcul multivariable.

Project: Calcul Libre
Views: 1413
Image: ubuntu2004
Kernel: SageMath 9.0

Exemple

On considère la fonction f(x,y)=(x2+y2)e(x2+y2)f(x,y) = (x^2 + y^2) e^{-(x^2+ y^2)}

%display typeset var('x,y') f(x,y) = (x^2+ y^2)*exp(-x^2 - y^2) cm = colormaps.autumn def c(x,y) : return float(f(x,y)/0.37) S=plot3d(f,(x,-2,2),(y,0-2,2), color = (c, cm)) show(S, aspect_ratio=[1,1,4] ) C= contour_plot(f, (x,-2, 2), (y,-2, 2),cmap='autumn',linestyles='solid', fill=False, colorbar = True) Champ = plot_vector_field(f.gradient(), (x,-2,2), (y,-2,2), color='blue') show(C+ Champ,figsize=5)
Image in a Jupyter notebook

Exemple

On considère la fonction f(x,y)=xsinyf(x,y) = x \sin y. On trouve lespoints critiques et on détermine leur nature.

var('x,y') f(x,y) = x*sin(y) cm = colormaps.autumn def c(x,y) : return float((f(x,y)+2*pi)/(4*pi)) S=plot3d(f,(x,-2*pi,2*pi),(y,-2*pi,2*pi), color=(c, cm)) show(S, aspect_ratio=[1,1,1] ) C= contour_plot(f, (x,-2*pi, 2*pi), (y,-2*pi, 2*pi),cmap='autumn',linestyles='solid', fill=True, colorbar = True, contours=20) Champ = plot_vector_field(f.gradient(), (x,-2*pi,2*pi), (y,-2*pi,2*pi), color='blue') show(C+ Champ,figsize=6)
Image in a Jupyter notebook

On peut aussi bien dessiner la surface avec une seule couleur, avec une grille, le résultat est décent.

Surf1 = plot3d(f, (x,-2*pi,2*pi),(y,-2*pi,2*pi), color = "orange", opacity = 0.65, mesh = 1) show(Surf1, aspect_ratio=[1,1,1])