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. ), tstep = 0.1 )
88
+ function get_phase_space_data (nameproblem, q₀, p₀, tspan = (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, tstep )
93
+ q,p = compute_phase_space (H_problem, q₀, p₀, tspan, timestep )
94
94
95
95
return (q, p)
96
96
end
97
97
98
98
99
- function get_phase_space_multiple_trajectoy (nameproblem; singlematrix = true , n_trajectory = 1 , n_points = 10 , tstep = 0.1 , qmin = - 0.2 , pmin = - 0.2 , qmax = 0.2 , pmax = 0.2 )
99
+ function get_phase_space_multiple_trajectoy (nameproblem; singlematrix = true , n_trajectory = 1 , n_points = 10 , timestep = 0.1 , qmin = - 0.2 , pmin = - 0.2 , qmax = 0.2 , pmax = 0.2 )
100
100
101
101
# get the Hamiltonien corresponding to name_problem
102
102
H_problem, n_dim = dict_problem_H[nameproblem]
103
103
104
104
# define timespan
105
- tspan= (0. ,n_points* tstep )
105
+ tspan= (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, tstep )
113
+ trajectory_q[i],trajectory_p[i] = compute_phase_space (H_problem, q₀, p₀, tspan, 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. ), tstep = 0.1 )
128
+ function compute_phase_space (H_problem, q₀, p₀, tspan = (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.), tstep =
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, tstep , q₀, p₀)
147
+ ode = HODEProblem (v, f, h, tspan, timestep , q₀, p₀)
148
148
149
149
# return sol = integrate(ode, SymplecticEulerA())
150
150
return sol = integrate (ode, SymplecticTableau (TableauExplicitEuler ()))
@@ -168,14 +168,14 @@ struct storing_data{T}
168
168
end
169
169
170
170
171
- function get_multiple_trajectory_structure (nameproblem; n_trajectory = 1 , n_points = 10 , tstep = 0.1 , qmin = - 1.2 , pmin = - 1.2 , qmax = 1.2 , pmax = 1.2 )
171
+ function get_multiple_trajectory_structure (nameproblem; n_trajectory = 1 , n_points = 10 , timestep = 0.1 , qmin = - 1.2 , pmin = - 1.2 , qmax = 1.2 , pmax = 1.2 )
172
172
173
173
174
174
# get the Hamiltonien corresponding to name_problem
175
175
H_problem, n_dim = dict_problem_H[nameproblem]
176
176
177
177
# define timespan
178
- tspan= (0. ,n_points* tstep )
178
+ tspan= (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, tstep )
187
+ q, p = compute_phase_space (H_problem, q₀, p₀, tspan, timestep )
188
188
189
189
Data = [(q[n], p[n]) for n in 1 : size (q,1 )]
190
190
@@ -194,14 +194,14 @@ function get_multiple_trajectory_structure(nameproblem; n_trajectory = 1, n_poin
194
194
pre_data = merge (pre_data,nt)
195
195
end
196
196
197
- data = storing_data (tstep , n_trajectory, pre_data)
197
+ data = storing_data (timestep , n_trajectory, pre_data)
198
198
199
199
200
200
201
201
return data # data_trajectory(data, Get_nb_trajectory, Get_length_trajectory, Get_q, Get_p, Get_Δt)
202
202
end
203
203
204
- function get_multiple_trajectory_structure_with_target (nameproblem; n_trajectory = 1 , n_points = 10 , tstep = 0.1 , qmin = - 0.2 , pmin = - 0.2 , qmax = 0.2 , pmax = 0.2 )
204
+ function get_multiple_trajectory_structure_with_target (nameproblem; n_trajectory = 1 , n_points = 10 , timestep = 0.1 , qmin = - 0.2 , pmin = - 0.2 , qmax = 0.2 , pmax = 0.2 )
205
205
206
206
207
207
# get the Hamiltonien corresponding to name_problem
@@ -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* tstep )
220
+ tspan= (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, tstep )
230
+ q, p = compute_phase_space (H_problem, q₀, p₀, tspan, 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 )]
@@ -243,7 +243,7 @@ function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory
243
243
244
244
end
245
245
246
- data = storing_data (tstep , n_trajectory, pre_data)
246
+ data = storing_data (timestep , n_trajectory, pre_data)
247
247
248
248
Get_Δt (Data) = Data. Δt
249
249
Get_nb_trajectory (Data) = Data. nb_trajectory
@@ -258,18 +258,18 @@ function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory
258
258
end
259
259
260
260
261
- function get_multiple_trajectory_structure_Lagrangian (nameproblem; n_trajectory = 1 , n_points = 10 , tstep = 0.1 , qmin = - 0.2 , pmin = - 0.2 , qmax = 0.2 , pmax = 0.2 )
261
+ function get_multiple_trajectory_structure_Lagrangian (nameproblem; n_trajectory = 1 , n_points = 10 , timestep = 0.1 , qmin = - 0.2 , pmin = - 0.2 , qmax = 0.2 , pmax = 0.2 )
262
262
263
263
264
264
# get the Hamiltonien corresponding to name_problem
265
265
H_problem, n_dim = dict_problem_L[nameproblem]
266
266
267
267
# define timespan
268
- tspan= (0. ,n_points* tstep )
268
+ tspan= (0. ,n_points* timestep )
269
269
270
270
# compute phase space for each trajectory staring from a random point
271
271
pre_data = []
272
- push! (pre_data,[tstep ])
272
+ push! (pre_data,[timestep ])
273
273
push! (pre_data,[n_trajectory])
274
274
push! (pre_data, [n_points+ 1 ])
275
275
@@ -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, tstep )
281
+ q, p = compute_phase_space (H_problem, q₀, p₀, tspan, timestep )
282
282
283
283
Data = [q[n] for n in 1 : size (q,1 )]
284
284
0 commit comments