Rungekutta
RungeKutta
Bases: _Generator_
This class is an implementation of Generator for a Runge-Kutta 4th order data generator.
Source code in phaseportrait/trajectories/rungekutta.py
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
__init__(portrait, dF, dimension, max_values, *, dt=0.1, dF_args=None, initial_values=None, thermalization=0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
portrait |
Object)
|
Class that uses the RungeKutta objects. |
required |
dF |
callable)
|
A dF type funcion. |
required |
dimension |
int)
|
Number of dimensions in which it calculates the next values. Must equal the amount of outputs the |
required |
max_values |
int)
|
Max number of values saved. |
required |
dt |
float, optional, by default 0.1)
|
Time interval used in the Runge-Kutta 4th order method. |
0.1
|
dF_args |
dict)
|
If necesary, must contain the kargs for the |
None
|
initial_values |
float, list, optional)
|
Initial set of conditions, by default None. If None, random initial conditions are aplied in the interval [0,1) for each coordinate. |
None
|
thermalization |
int, optional)
|
Thermalization steps before data is saved, by default None. If None, thermalization steps are set to 0. |
0
|
Source code in phaseportrait/trajectories/rungekutta.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
clear_values()
Clears the data arrays self.positions
and self.velocities
.
Source code in phaseportrait/trajectories/rungekutta.py
87 88 89 90 91 92 |
|
instance_and_compute_all(portrait, dF, dimension, dF_args, initial_values, max_values, save_freq=1, dt=0.1, thermalization=0)
classmethod
Creates an instance of phase-portrait.trajectories.RungeKutta. Computes all the data requested and returns the instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
portrait |
Object
|
Class that uses the RungeKutta objects. |
required |
dF |
callable)
|
A dF type funcion. |
required |
dimension |
int)
|
Number of dimensions in which it calculates the next values. Must equal the amount of outputs the |
required |
dF_args |
dict)
|
If necesary, must contain the kargs for the |
required |
initial_values |
float, list, optional)
|
Initial set of conditions, by default None. If None, random initial conditions are aplied in the interval [0,1) for each coordinat |
required |
max_values |
int)
|
Max number of values saved. |
required |
save_freq |
int, optional, by default 1)
|
Number of values computed before saving them. |
1
|
dt |
float, optional, by default 0.1)
|
Time interval used in the Runge-Kutta 4th order method. |
0.1
|
thermalization |
int, optional)
|
Thermalization steps before data is saved, by default None. If None, thermalization steps are set to 0. |
0
|
Source code in phaseportrait/trajectories/rungekutta.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
save(i)
Saves self.position
in the attribute self.positions
, and self.velocity
in self.velocities
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
i |
int)
|
Index in which the data is saved. |
required |
Source code in phaseportrait/trajectories/rungekutta.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|