-
Notifications
You must be signed in to change notification settings - Fork 0
/
HamiltonForm.m
46 lines (41 loc) · 926 Bytes
/
HamiltonForm.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(* ::Package:: *)
(* ::Input:: *)
(*Clear["Global`*"]*)
(*F[x_]:=x y[x]Sqrt[y'[x]];*)
(*(*Hamilton Form*)*)
(*H[x_]:=y'[x]D[F[x],y'[x]]-F[x];*)
(*p[x_]:=D[F[x],y'[x]]*)
(*H[x]*)
(*p[x]*)
(*Clear["Global`*"]*)
(*(*Replace y'[x] with p[x]*)*)
(*H[x_]:=-x^2y[x]^2/(4p[x])*)
(*{*)
(*D[H[x],p[x]]==y'[x],*)
(*D[H[x],y[x]]==-D[p[x],x]*)
(*}*)
(* ::Input:: *)
(**)
(*Clear["Global`*"]*)
(*F[x_]:=x^2+y1[x]y1'[x]^2+y2[x]y2'[x]^2;*)
(*(*Hamilton Form*)*)
(*H1[x_]:=y1'[x]D[F[x],y1'[x]]-F[x]*)
(*H2[x_]:=y2'[x]D[F[x],y2'[x]]-F[x];*)
(*p1[x_]:=D[F[x],y1'[x]]*)
(*p2[x_]:=D[F[x],y2'[x]]*)
(*H1[x]*)
(*H2[x]*)
(*p1[x]*)
(*p2[x]*)
(*Clear["Global`*"]*)
(*(*Replace y'[x] with p[x]*)*)
(*H1[x_]:=p1[x]^2/4/y1[x]-x^2-p2[x]^2/4/y2[x]*)
(*H2[x_]:=p2[x]^2/4/y2[x]-x^2-p1[x]^2/4/y1[x]*)
(*{*)
(*D[H1[x],p1[x]]==y1'[x],*)
(*D[H1[x],y1[x]]==-D[p1[x],x],*)
(*D[H2[x],p2[x]]==y2'[x],*)
(*D[H2[x],y2[x]]==-D[p2[x],x]*)
(*}*)
(* ::Input:: *)
(**)