Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 114
Kernel: SageMath (stable)
%display typeset

Exemple

Considérer le champ de vecteurs F(x,y)=(2(y1),3x2+4x+2)\mathbf{F}(x,y) = (2(y-1), 3x^2+ 4x+2). Tracer le champ, puis la ligne de courant passant par (0,1)(0,-1).

var('x,y') P(x,y) = 2*(y-1) Q(x,y) = 3*x^2+4*x+2 Champ = plot_vector_field((P(x,y), Q(x,y)), (x,-2.5,2.5), (y,-2.5,2.5), color= "blue") show(Champ, aspect_ratio = 1, figsize=6)
Image in a Jupyter notebook
Flot = streamline_plot((P(x,y), Q(x,y)), (x,-2.5,2.5), (y,-2.5,2.5), color= "blue") show(Flot,aspect_ratio =1, figsize = 6)
Image in a Jupyter notebook

Pour trouver la ligne de courant on résoud une équation différentielle. Ceci a été fait manuellement en classe, mais on peut le faire à l'ordinateur également (voir plus bas).

Ligne = implicit_plot(y^2-2*y -(x^3+2*x^2+2*x+3)==0, (x,-2.5,2.5),(y,-2.5,2.5), color = "red") show(Champ + Ligne)
Image in a Jupyter notebook
show(Flot + Ligne)
Image in a Jupyter notebook
y = function('y')(x) # Il faut faire comprendre à SAGE que dorénavant y est une fonction, pas une variable desolve(diff(y,x) == Q(x,y)/P(x,y), y, ics=[0,-1]) # ics c'est pour initial conditions.