Difference between revisions of "Dynamics of a particle in a central field"
From Department of Theoretical and Applied Mechanics
(Created page with "Virtual laboratory > Dynamics of a particle in a central field <HR> Developer: А.М. Кривцов<HR> Interactive application, shown below, allows us to study...") |
|||
Line 2: | Line 2: | ||
Developer: [[А.М. Кривцов]]<HR> | Developer: [[А.М. Кривцов]]<HR> | ||
− | Interactive application, shown below, allows us to study the trajectories of a particle in the central power-law potential field. | + | Interactive application, shown below, allows us to study the trajectories of a particle in the central power-law potential field. Interaction force <math>F</math> is a polynomial function of distance <math>r</math>: |
:<math>F \sim r^n,</math> | :<math>F \sim r^n,</math> |
Revision as of 14:44, 1 June 2016
Virtual laboratory > Dynamics of a particle in a central fieldDeveloper: А.М. Кривцов
Interactive application, shown below, allows us to study the trajectories of a particle in the central power-law potential field. Interaction force
is a polynomial function of distance :where
is some real dimensionless degree exponent. The attraction center is at the point.
v0 = v1
n =
zoom =
tmax = T
Номер эксперимента
The text of the program is written in JavaScript:
Файл "FC.js"
1 //The movement of a material point in the central field
2 //A.M developer. Krivtsov
3 //18-21.05.2014
4 //Internet: tm.spbstu.ru/FC
5
6 function MainFC(canvas) {
7
8 // main parameters
9
10 const m = 1.; // weight
11 const a = 1.; // radius
12 const P = 1.; // gravitation force
13
14 // Derivative dimensional parameters
15
16 const T = 2 * Math.PI * Math.sqrt(m * a / P); // period of the movement on a circular orbit
17 const v1 = Math.sqrt(P * a / m); // speed of the movement on a circular orbit (the 1st space)
18
19 // Variables
20
21 var n, v0, zoom, t_max, dt;
22
23 // setting of sliders
24
25 Slider_01.min = 1; Slider_01.max = 22; Slider_01.step = 0.1; // v0 / v1 - initial velocity
26 Slider_02.max = 6; Slider_02.min = -Slider_02.max; Slider_02.step = 0.01; // n - degree indicator
27 Slider_03.min = 0; Slider_03.max = 6; Slider_03.step = 0.01; // zoom
28 Slider_04.min = 0; Slider_04.max = 100; Slider_04.step = 0.1; // t_max/T - time for calculation
29 Slider_05.min = 1; Slider_05.max = set_exp(0); Slider_05.step = 1; // N_exp - experiment number
30
31 Slider_05.focus();
32
33 // values of variables
34
35 dt = T / 200; // integration step
36 set_exp(6); // variables are set for experiment 6
37
38 // display
39
40 draw();
41
42 // the functions which are started at change of values of sliders and text fields
43
44 this.set_01 = function(input) { v0 = Number(input) * v1; draw(); }
45 this.set_02 = function(input) { n = Number(input); draw(); }
46 this.set_03 = function(input) { zoom = Number(input); draw(); }
47 this.set_04 = function(input) { t_max = Number(input) * T; draw(); }
48 this.set_05 = function(input) { set_exp(input); draw(); }
49
50 // display
51
52 function draw()
53 {
54 // optimizing
55
56 var n1 = (1 - n) / 2;
57 var dt1 = -P / m * Math.pow(a, -n) * dt;
58
59 // Area of creation of the schedule
60
61 const X_max = canvas.width, Y_max = canvas.height;
62 var x_max, y_max, sx, sy, X0, Y0;
63
64 x_max = y_max = Math.pow(2, zoom) * a; // size of area of display
65 x_min = y_min = -x_max;
66
67 sx = sy = Y_max / (y_max - y_min); // scale on an axis y
68 X0 = Y0 = Y_max + y_min * sy; // the provision 0 of an axis y in screen coordinates
69
70 // Initialization of graphics
71
72 var context = canvas.getContext("2d"); // context - for drawing
73 context.clearRect(0, 0, X_max, Y_max); // clear screen
74
75 // horizontal axis
76 context.strokeStyle = 'lightgrey';
77 context.beginPath();
78 context.moveTo(0, Y0); context.lineTo(X_max, Y0);
79 context.moveTo(X0, 0); context.lineTo(X0, Y_max);
80 context.moveTo(X0 + a * sx, Y0); context.arc(X0, Y0, a * sx, 0, 2 * Math.PI);
81 context.stroke();
82
83 // inscription
84 context.fillStyle = 'black';
85 context.font = "italic 20px Times";
86 context.fillText("0", X0 - 15, Y0 - 7);
87
88 // schedule
89 context.strokeStyle = 'black';
90 context.beginPath();
91 var vx = v0, vy = 0;
92 var x = 0, y = a;
93 context.moveTo(X0, Y0 - a * sy);
94 for (var t = 0; t < t_max; t += dt)
95 {
96 var r2 = x * x + y * y;
97 var rn = Math.pow(r2, n1);
98 vx += x / rn * dt1;
99 vy += y / rn * dt1;
100 x += vx * dt;
101 y += vy * dt;
102 var X = X0 + x * sx;
103 var Y = Y0 - y * sy;
104 context.lineTo(X, Y);
105 }
106 context.stroke();
107 }
108
109 // Experiment choice
110
111 function set_exp(N_exp)
112 {
113 var k = Number(N_exp);
114
115 // degree indicator initial velocity zoom max number of steps
116
117 if (!--k) { n = -3; v0 = 1.004 * v1; zoom = 2.98; t_max = 17.4 * T; } // spiral
118 if (!--k) { n = -2.9; v0 = 1.023 * v1; zoom = 2.98; t_max = 67.6 * T; }
119 if (!--k) { n = -2.87; v0 = 1.029 * v1; zoom = 2.57; t_max = 21.6 * T; }
120 if (!--k) { n = -2.87; v0 = 1.03 * v1; zoom = 2.96; t_max = 94.4 * T; }
121 if (!--k) { n = -2.5; v0 = 1.135 * v1; zoom = 2.98; t_max = 31.1 * T; } // 2
122
123 if (!--k) { n = -2; v0 = 1.25 * v1; zoom = 2; t_max = 20 * T; } // ellipse
124 if (!--k) { n = -1; v0 = 1.25 * v1; zoom = 1; t_max = 26 * T; }
125 if (!--k) { n = -1; v0 = 1.36 * v1; zoom = 1.18; t_max = 10.8 * T; } // 10
126 if (!--k) { n = -1; v0 = 1.63 * v1; zoom = 1.87; t_max = 25.3 * T; }
127 if (!--k) { n = -1; v0 = 1.93 * v1; zoom = 2.8; t_max = 8 * T; } // 3 !
128 if (!--k) { n = -1; v0 = 2.31 * v1; zoom = 3.92; t_max = 64.1 * T; } // 11
129 if (!--k) { n = -1; v0 = 2.43 * v1; zoom = 4.29; t_max = 61.8 * T; } // 8
130 if (!--k) { n = -1; v0 = 2.74 * v1; zoom = 5.5; t_max = 85.5 * T; } // 5
131
132 if (!--k) { n = -0.74; v0 = 2.665 * v1; zoom = 3.81; t_max = 18.8 * T; } // 5
133
134 if (!--k) { n = 0; v0 = 1.66 * v1; zoom = 1.39; t_max = 5.1 * T; } // 7
135 if (!--k) { n = 0; v0 = 2.7 * v1; zoom = 2.34; t_max = 8.9 * T; } // 9
136 if (!--k) { n = 0; v0 = 3.46 * v1; zoom = 3.03; t_max = 13.3 * T; } // 11
137
138 if (!--k) { n = 1; v0 = 2 * v1; zoom = 1.3; t_max = 1 * T; } // 11
139
140 if (!--k) { n = 2; v0 = 2.39 * v1; zoom = 1.18; t_max = 4.0 * T; } // 11
141
142 if (!--k) { n = 3; v0 = 3.58 * v1; zoom = 1.28; t_max = 1.8 * T; } // 7
143 if (!--k) { n = 3; v0 = 6.97 * v1; zoom = 1.87; t_max = 1.7 * T; } // 9
144 if (!--k) { n = 3; v0 = 11.28 * v1; zoom = 2.13; t_max = 1.6 * T; } // 11
145 if (!--k) { n = 3; v0 = 16.13 * v1; zoom = 2.50; t_max = 1.6 * T; } // 13
146
147 if (!--k) { n = 3.29; v0 = 1.3 * v1; zoom = 0.48; t_max = 1.8 * T; } // 13
148
149 if (!--k) { n = 4; v0 = 3.36 * v1; zoom = 1.12; t_max = 1.1 * T; } // 5 !
150 if (!--k) { n = 4; v0 = 6.08 * v1; zoom = 1.44; t_max = 1.9 * T; } // 12
151 if (!--k) { n = 4; v0 = 9.52 * v1; zoom = 1.66; t_max = 0.9 * T; } // 7 !
152 if (!--k) { n = 4; v0 = 18.45 * v1; zoom = 2.18; t_max = 0.728 * T; } // 9
153
154 if (!--k) { n = 5; v0 = 7.15 * v1; zoom = 1.55; t_max = 0.6 * T; } // 5 !
155
156 if (!--k) { n = 4; v0 = 3.304 * v1; zoom = 1.12; t_max = 36.4 * T; } // 5 ~~~
157 if (!--k) { n = 4; v0 = 9.394 * v1; zoom = 1.66; t_max = 19.6 * T; } // 7 ~~~
158
159 if (N_exp)
160 {
161 Text_01.value = v0 / v1; Slider_01.value = Text_01.value; // initial velocity
162 Text_02.value = n; Slider_02.value = Text_02.value; // degree indicator
163 Text_03.value = zoom; Slider_03.value = Text_03.value; // zoom
164 Text_04.value = t_max / T; Slider_04.value = Text_04.value; // time for calculation
165 Text_05.value = N_exp; Slider_05.value = Text_05.value; // number of experiment
166 }
167
168 return -k; // Если N_exp = 0 returns total of experiments, in other cases returns 0
169 }
170 }
Файл "FC.html"
1 <canvas id="canvasGraph" width="600" height="600" style="border:1px solid #000000;"></canvas>
2
3 <!--Installation of parameters of interaction (text fields and sliders)-->
4 <div>
5 <font face= "Times New Roman"><I>
6 v</I><SUB>0</SUB> = <input id="Text_01" style="width: 4.2ex;" required pattern="[-+]?([0-9]*\.[0-9]+|[0-9]+)" oninput="
7 // if not the number is entered - the line won't pass validation on a pattern above, and checkValidity () will return false
8 if (!this.checkValidity()) return;
9 app.set_01(this.value);
10 document.getElementById('Slider_01').value = this.value;
11 "><I> v</I><SUB>1</SUB>
12 <input type="range" id="Slider_01" style="width: 100px;" oninput="app.set_01(this.value); document.getElementById('Text_01').value = this.value;">
13 n = <input id="Text_02" style="width: 4.2ex;" required pattern="[-+]?([0-9]*\.[0-9]+|[0-9]+)" oninput="
14 if (!this.checkValidity()) return;
15 app.set_02(this.value);
16 document.getElementById('Slider_02').value = this.value;
17 ">
18 <input type="range" id="Slider_02" style="width: 100px;" oninput="app.set_02(this.value); document.getElementById('Text_02').value = this.value;">
19 </font>
20 </div>
21 <div>
22 <font face= "Times New Roman">
23 zoom = <input id="Text_03" style="width: 4.2ex;" required pattern="[-+]?([0-9]*\.[0-9]+|[0-9]+)" oninput="
24 // if not the number is entered - the line won't pass validation on a pattern above, and checkValidity () will return false
25 if (!this.checkValidity()) return;
26 app.set_03(this.value);
27 document.getElementById('Slider_03').value = this.value;
28 ">
29 <input type="range" id="Slider_03" style="width: 100px;" oninput="app.set_03(this.value); document.getElementById('Text_03').value = this.value;">
30 <I>t</I><SUB>max</SUB> = <input id="Text_04" style="width: 4.2ex;" required pattern="[-+]?([0-9]*\.[0-9]+|[0-9]+)" oninput="
31 if (!this.checkValidity()) return;
32 app.set_04(this.value);
33 document.getElementById('Slider_04').value = this.value;
34 "><I> T</I>
35 <input type="range" id="Slider_04" style="width: 100px;" oninput="app.set_04(this.value); document.getElementById('Text_04').value = this.value;">
36 </font>
37 </div>
38 <div>
39 <font face= "Times New Roman">
40 Number of experiment <input id="Text_05" style="width: 4.2ex;" required pattern="[-+]?([0-9]*\.[0-9]+|[0-9]+)" oninput="
41 // if not the number is entered - the line won't pass validation on a pattern above, and checkValidity () will return false
42 if (!this.checkValidity()) return;
43 app.set_05(this.value);
44 document.getElementById('Slider_05').value = this.value;
45 ">
46 <input type="range" id="Slider_05" style="width: 100px;" oninput="app.set_05(this.value); document.getElementById('Text_05').value = this.value;">
47 </div>
48
49 <script type="text/javascript">var app = new MainFC (
50 document.getElementById('canvasGraph')
51 );</script>
The application allows to set the following parameters interactively:
- — initial velocity of the point. The initial velocity is directed tangentially (perpendicular to the radial direction).Velocity is measured in relation to the - speed circular motion on the initial distance from the center (the first cosmic speed).
- — is an index in the law of interaction( corresponds to the gravitational interaction, - the linear-elastic).
- zoom is the logarithmic scale of display of the schedule (the logarithm on the basis 2 is used).
- — integration time expressed in periods of circular motion at the initial distance from the center.
Besides, it is possible to set "number of the experiment". Every number has a separate set of four parameters named above and characterized by some specific kind of movement. Experiments are ordered by
(first), then by .The proposed research areas
- To define possible variants of motion
- To define the dependence of the distance to the epicenter (the most distant point) of the orbit from and .
- To find closed trajectories of different topologies (for example, 5th, the 7th terminating stars, etc.) and to determine their position on the plane of the parameters , .
- To find a method for integrating of the equations of motion with a variable step allowing to model the movement of a point at large effectively.
- • To pick up values of parameters (and to develop a method of such selection), allowing to receive "beautiful" schedules which can be considered as objects of Science Art (see in particular, last numbers of experiments).