input gdd;
input gdd-rep;
input gdd-lbl;
input gdd-tra;
input svgnames;
prologues := 3;
outputtemplate := "svg/%j-%c.svg";
outputformat := "svg";
lblPreambule := "\usepackage{amsmath}";
input gdd-fct;
input gdd-plt;
%numberprecision := 16;
vardef f(expr x) = 1+a*x/(1+x) enddef;
numeric b,c;
b:=0.5;
c=1.0;
path trajectoire,sol;
trajectoire := gddTraceCourbe("solution0.dat");
sol := gddTraceCourbe("solution0tps.dat");
numeric len;
len := length(trajectoire);
picture portrait, solution,pendule;
vardef F(expr x,y) = (y,-b*y-c*sin(x)) enddef;
for i=0 upto len:
beginfig(i);
portrait := image(
gddXlabel := "$\theta$";
gddYlabel := "$\dot\theta$";
Repere(10,6,2,4,2,2);
Axes;
Debut;
Unites(1);
Graduations;
ChampVecteursDD(F,0.5,0.5,0.2,0.2,0.15,0.5white);
color couleur; couleur = (0.9,0.1,0.9);
trace subpath (0,i) of trajectoire withcolor couleur withpen pencircle scaled 1;
pointe Point(0,0) withcolor red;
pointe Point(3.1415,0) withcolor red;
Fin;
);
solution := image(
gddXlabel := "$\theta$";
gddYlabel := "$t$";
Repere(10,5,0.3,1,0.4,1);
Axes;
Debut;
Unites(1);
Graduations;
trace subpath (0,i) of sol withcolor couleur withpen pencircle scaled 1;
Fin;
);
pendule := image(
pair pointC;
pointC := point i of sol;
numeric theta;
theta := ypart pointC;
show theta;
pair endP;
endP := -4(sin(theta),cos(theta));
trace (0,0)--endP withcolor couleur withpen pencircle scaled 1;
pointe Point(0,0);
pointe endP;
trace (-4.5,-4.5)--(-4.5,4.5)--(4.5,4.5)--(4.5,-4.5)--cycle;
);
draw solution shifted (0,7gddU);
draw portrait;
draw pendule shifted (5gddU,17gddU);
Etiquette("$\ddot\theta=-b\dot\theta-c\sin\theta$",1.5,(5,-0.7));
endfig;
endfor;
end