Beruflich Dokumente
Kultur Dokumente
O EQx := isolate(select(has,Q,diff(x(t),t,t))[1],diff(x(t),t,t));
d2 2l t x t
EQx := 2 x t = K (9)
dt m
O EQy := isolate(select(has,Q,diff(y(t),t,t))[1],diff(y(t),t,t));
d2 m g C2 l t y t
EQy := 2 y t = K (10)
dt m
O EQc := remove(has,Q,diff)[1];
EQc := Kx t 2 Ky t 2 Cl2 (11)
Now we have the equations of motion for the pendulum. Next, we need to
determine consistent initial conditions. To do so, we must identify
any hidden constraints of the system. These are easy to find, as we
have only one constraint.
O Dcon := diff(EQc,t);
d d
Dcon := K2 x t x t K2 y t y t (12)
dt dt
O DDcon := eval(diff(Dcon,t),{EQx,EQy});
d 2
4x t 2l t d 2
2 y t m g C2 l t y t
DDcon := K2 x t C K2 y t C (13)
dt m dt m
Our initial conditions must satisfy EQc, Dcon, and DDcon at the
initial point, leaving only 2 degrees of freedom for the conditions.
So for a pendulum starting at the minimum value of y(0)=-l having an
initial horizontal velocity of D(x)(0)=vx, we get:
O sys := {y(0)=-l,D(x)(0)=vx} union
O eval(convert({EQc,Dcon,DDcon},D),t=0);
2 2
Cl2, K2 D x 0 2
sys := K2 x 0 D x 0 K2 y 0 D y 0 , Kx 0 Ky 0 (14)
2
4x 0 l 0 2 2y 0 m g C2 l 0 y 0
C K2 D y 0 C , y 0 = Kl, D x 0
m m
= vx
O ini := solve(sys,{x(0),y(0),D(x)(0),D(y)(0),lambda(0)});
1 m vx2 Cl g
ini := x 0 = 0, y 0 = Kl, l 0 = , D x 0 = vx, D y 0 = 0 , x 0 (15)
2 l2
1 m vx2 Cl g
= 0, y 0 = Kl, l 0 = , D x 0 = vx, D y 0 = 0
2 l2
So we consider the above with a pendulum of unit length l=1 having
unit mass m=1 and an initial horizontal velocity of vx=1/10, giving us
the DAE system and initial conditions:
O dsys := eval({EQx,EQy,EQc},{l=1,m=1,g=9.8,vx=1/10});
2 2 d2 d2
dsys := Kx t Ky t C1, 2 x t = K2 l t x t , 2 y t = K9.8 K2 l t y t (16)
dt dt
O dini := eval(ini,{l=1,m=1,g=9.8,vx=1/10});
(17)
Please purchase PDFcamp Printer on http://www.verypdf.com/ to remove this watermark.
1
dini := x 0 = 0, y 0 = K1, l 0 = 4.905000000, D x 0 = , D y 0 = 0 , x 0 = 0, (17)
10
1
y 0 = K1, l 0 = 4.905000000, D x 0 = , D y 0 =0
10
We can then obtain the solution as:
O dsol1 := dsolve(dsys union dini, numeric);
dsol1 := proc x_rkf45_dae ... end proc (18)
O dsol1(1/2);
t = 0.50000000000000, l t = 4.89750023718481130, x t = 0.0319392567602705264, (19)
d d
x t = 0.000564534945357487062, y t = K0.999489811809633810, y t
dt dt
= 0.0000180391871694894626
O dsol1(1);
d
t = 1., l t = 4.90499905063547725, x t = 0.000360893055436694612, x t = (20)
dt
d
K0.0999936889628538496, y t = K0.99999993484238748, y t =
dt
K0.0000360863451521704686
Solution with rosenbrock_dae:
O dsol2 := dsolve(dsys union dini, numeric, method=rosenbrock_dae)
;
dsol2 := proc x_rosenbrock_dae ... end proc (21)
O dsol2(1/2);
t = 0.50000000000000, l t = 4.89750021975059634, x t = 0.0319393321006469708, (22)
d d
x t = 0.000564588647654044744, y t = K0.999489810067037854, y t
dt dt
= 0.0000180297223985542616
O dsol2(1);
d
t = 1., l t = 4.90499907169581384, x t = 0.000360989082309098159, x t = (23)
dt
d
K0.0999937377604132594, y t = K0.99999993774710982, y t =
dt
K0.0000360873117963881080
Solution with mebdfi:
O dsol3 := dsolve(dsys union dini, numeric, method=mebdfi);
dsol3 := proc x_mebdfi ... end proc (24)
O dsol3(1/2);
t = 0.50000000000000, l t = 4.89750245194350508, x t = 0.0319388403694855148, (25)
Please purchase PDFcamp Printer on http://www.verypdf.com/ to remove this watermark.
d d
x t = 0.000564871203422257006, y t = K0.999489825189509128, y t
dt dt
= 0.0000180670454630691393
O dsol3(1);
d
t = 1., l t = 4.90497944724429935, x t = 0.000361097312194549837, x t = (26)
dt
d
K0.0999925039194764776, y t = K0.99999993426187950, y t =
dt
K0.0000359881610159317974
Now consider a similar problem as above, but in addition add a second
mass supported from the first by another string, this one of length
1/2 (the double pendulum). The system can be obtained and solved as:
O dsysd := {
O diff(x1(t),t,t) +2*lambda1(t)*x1(t)+2*lambda2(t)*(x1(t)-x2
(t)),
O diff(y1(t),t,t)+9.8+2*lambda1(t)*y1(t)+2*lambda2(t)*(y1(t)-y2
(t)),
O diff(x2(t),t,t) -2*lambda2(t)*(x1(t)-x2
(t)),
O diff(y2(t),t,t)+9.8 -2*lambda2(t)*(y1(t)-y2
(t)),
O x1(t)^2+y1(t)^2-1,
O (x1(t)-x2(t))^2+(y1(t)-y2(t))^2-1/4
O };
d2 1
dsysd := 2
x2 t K2 l2 t x1 t Kx2 t , x1 t Kx2 t 2 C y1 t Ky2 t 2 K , (27)
dt 4
2 2 d2 d2
x1 t Cy1 t K1, 2 x1 t C2 l1 t x1 t C2 l2 t x1 t Kx2 t , 2 y2 t
dt dt
2
d
C9.8 K2 l2 t y1 t Ky2 t , 2 y1 t C9.8 C2 l1 t y1 t C2 l2 t y1 t
dt
Ky2 t
O ics := {x1(0)=0,D(x1)(0)=-3,y1(0)=-1,D(y1)(0)=0,
O x2(0)=0,D(x2)(0)=4,y2(0)=-3/2,D(y2)(0)=0};
3
ics := x1 0 = 0, x2 0 = 0, y1 0 = K1, y2 0 = K , D x1 0 = K3, D x2 0 = 4, (28)
2
D y1 0 = 0, D y2 0 = 0
x2
K0.4 K0.2 0 0.2 0.4 0.6 0.8
K0.6
K0.8
y2
K1.0
K1.2
K1.4
O?
`?` (30)
O