85
85
# #######################################################################################
86
86
# get data of a problem for Sypmnet (results is (data = target =(q,p))) from Hamiltonian
87
87
88
- function get_phase_space_data (nameproblem, q₀, p₀, tspan = (0. , 100. ), timestep = 0.1 )
88
+ function get_phase_space_data (nameproblem, q₀, p₀, timespan = (0. , 100. ), timestep = 0.1 )
89
89
90
90
# get the Hamiltonien corresponding to name_problem
91
91
H_problem, n_dim = dict_problem_H[nameproblem]
92
92
93
- q,p = compute_phase_space (H_problem, q₀, p₀, tspan , timestep)
93
+ q,p = compute_phase_space (H_problem, q₀, p₀, timespan , timestep)
94
94
95
95
return (q, p)
96
96
end
@@ -102,15 +102,15 @@ function get_phase_space_multiple_trajectoy(nameproblem; singlematrix = true, n_
102
102
H_problem, n_dim = dict_problem_H[nameproblem]
103
103
104
104
# define timespan
105
- tspan = (0. ,n_points* timestep)
105
+ timespan = (0. ,n_points* timestep)
106
106
107
107
# compute phase space for each trajectory staring from a random point
108
108
trajectory_q = [zeros (n_points+ 1 ,n_dim) for _ in 1 : n_trajectory]
109
109
trajectory_p = [zeros (n_points+ 1 ,n_dim) for _ in 1 : n_trajectory]
110
110
for i in 1 : n_trajectory
111
111
q₀ = [rand ()* (qmax- qmin)+ qmin for _ in 1 : n_dim]
112
112
p₀ = [rand ()* (pmax- pmin)+ pmin for _ in 1 : n_dim]
113
- trajectory_q[i],trajectory_p[i] = compute_phase_space (H_problem, q₀, p₀, tspan , timestep)
113
+ trajectory_q[i],trajectory_p[i] = compute_phase_space (H_problem, q₀, p₀, timespan , timestep)
114
114
end
115
115
116
116
if singlematrix
125
125
# ##############################################################################
126
126
# compute phase space from the Hamiltonian
127
127
128
- function compute_phase_space (H_problem, q₀, p₀, tspan = (0. , 100. ), timestep = 0.1 )
128
+ function compute_phase_space (H_problem, q₀, p₀, timespan = (0. , 100. ), timestep = 0.1 )
129
129
130
130
n_dim = length (q₀)
131
131
@@ -144,7 +144,7 @@ function compute_phase_space(H_problem, q₀, p₀, tspan = (0., 100.), timestep
144
144
h (t, q, p, params) = H2 (q,p)
145
145
146
146
# simulate data with geometric Integrators
147
- ode = HODEProblem (v, f, h, tspan , timestep, q₀, p₀)
147
+ ode = HODEProblem (v, f, h, timespan , timestep, q₀, p₀)
148
148
149
149
# return sol = integrate(ode, SymplecticEulerA())
150
150
return sol = integrate (ode, SymplecticTableau (TableauExplicitEuler ()))
@@ -175,7 +175,7 @@ function get_multiple_trajectory_structure(nameproblem; n_trajectory = 1, n_poin
175
175
H_problem, n_dim = dict_problem_H[nameproblem]
176
176
177
177
# define timespan
178
- tspan = (0. ,n_points* timestep)
178
+ timespan = (0. ,n_points* timestep)
179
179
180
180
# compute phase space for each trajectory staring from a random point
181
181
pre_data = NamedTuple ()
@@ -184,7 +184,7 @@ function get_multiple_trajectory_structure(nameproblem; n_trajectory = 1, n_poin
184
184
185
185
q₀ = [rand ()* (qmax- qmin)+ qmin for _ in 1 : n_dim]
186
186
p₀ = [rand ()* (pmax- pmin)+ pmin for _ in 1 : n_dim]
187
- q, p = compute_phase_space (H_problem, q₀, p₀, tspan , timestep)
187
+ q, p = compute_phase_space (H_problem, q₀, p₀, timespan , timestep)
188
188
189
189
Data = [(q[n], p[n]) for n in 1 : size (q,1 )]
190
190
@@ -217,7 +217,7 @@ function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory
217
217
dH (x) = symplectic_matrix * ∇H (x)
218
218
219
219
# define timespan
220
- tspan = (0. ,n_points* timestep)
220
+ timespan = (0. ,n_points* timestep)
221
221
222
222
# compute phase space for each trajectory staring from a random point
223
223
pre_data = NamedTuple ()
@@ -227,7 +227,7 @@ function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory
227
227
228
228
q₀ = [rand ()* (qmax- qmin)+ qmin for _ in 1 : n_dim]
229
229
p₀ = [rand ()* (pmax- pmin)+ pmin for _ in 1 : n_dim]
230
- q, p = compute_phase_space (H_problem, q₀, p₀, tspan , timestep)
230
+ q, p = compute_phase_space (H_problem, q₀, p₀, timespan , timestep)
231
231
232
232
Data = [(q[n], p[n]) for n in 1 : size (q,1 )]
233
233
data_calc = [[q[n]. .. , p[n]. .. ] for n in 1 : size (q,1 )]
@@ -265,7 +265,7 @@ function get_multiple_trajectory_structure_Lagrangian(nameproblem; n_trajectory
265
265
H_problem, n_dim = dict_problem_L[nameproblem]
266
266
267
267
# define timespan
268
- tspan = (0. ,n_points* timestep)
268
+ timespan = (0. ,n_points* timestep)
269
269
270
270
# compute phase space for each trajectory staring from a random point
271
271
pre_data = []
@@ -278,7 +278,7 @@ function get_multiple_trajectory_structure_Lagrangian(nameproblem; n_trajectory
278
278
279
279
q₀ = [rand ()* (qmax- qmin)+ qmin for _ in 1 : n_dim]
280
280
p₀ = [rand ()* (pmax- pmin)+ pmin for _ in 1 : n_dim]
281
- q, p = compute_phase_space (H_problem, q₀, p₀, tspan , timestep)
281
+ q, p = compute_phase_space (H_problem, q₀, p₀, timespan , timestep)
282
282
283
283
Data = [q[n] for n in 1 : size (q,1 )]
284
284
0 commit comments