Modelowanie matematyczne

Ostatnie cwiczenia przed kolokwium

DSolve

DSolve[y'[x]+y[x]==a Sin[x],y[x],x]
y[x]/.%

ReplaceAll

NDSolve[{x'[t]==μ (x[t]-((x[t])^3)/3)+y[t],y'[t]==-x[t]}, {x,y},t]

μ=1;
s=NDSolve[{x'[t]==μ (x[t]-((x[t])^3)/3)+y[t],y'[t]==-x[t],x[0]==y[0]==1},{x,y},{t,20}]
ParametricPlot[Evaluate[{x[t],y[t]}/.s],{t,0,20}]

Solve[{0==mu (x-(x^3)/3)+y,0==-x},{x,y}]

D[{mu (x-(x^3)/3)+y,-x},{{x,y}}]
Eigenvalues[%]
%/.x->0
Plot[Evaluate[%],{mu,0,10},PlotStyle->Thick]

Manipulate[{(1/2) (mu-(Sqrt[-4+(mu^2)])),(1/2) (mu+(Sqrt[-4+(mu^2)]))},{mu,0,5}]

μ=2;
Manipulate[
s=NDSolve[{x'[t]==μ (x[t]-((x[t])^3)/3)+y[t],y'[t]==-x[t],x[0]==u[[1]],y[0]==u[[2]]},{x,y},{t,200}];
GraphicsColumn[{Show[ParametricPlot[Evaluate[{x[t],y[t]}/.s],{t,0,200},PlotStyle->Directive[Red,Thick],PlotRange->{{-5,5},{-5,5}}],
VectorPlot[{μ (x-(x^3)/3)+y,-x},{x,-5,5},{y,-5,5},VectorScale->{Automatic,Automatic,None}]],Plot[Evaluate[{x[t],y[t]}/.s],{t,0,30},PlotLegends->LineLegend["Expressions",LegendLabel->"label",LegendFunction->(Framed[#,RoundingRadius->1]&),LegendMargins->0.1]]}

],{u,{-5,-5},{5,5}},ControlType->Slider2D,ControlPlacement->Left]