20 lines
474 B
Text
20 lines
474 B
Text
/* Počáteční podmínky */
|
|
let bc = {t:0.0, w:[1.0, 0.0]}
|
|
/* Konstanty */
|
|
const f = 6.2831853
|
|
const fq = f * f;
|
|
/* Hamiltonovy rovnice */
|
|
let pf = [
|
|
(o) => {
|
|
return o.w[1];
|
|
},
|
|
(o) => {
|
|
return - fq * o.w[0];
|
|
},
|
|
];
|
|
let r = solve (0.01, 100, bc, pf); /* řešení */
|
|
/* Grafy */
|
|
plot (r, {x:['t'], y:['w', 0]}, '#00ff00');
|
|
plot (r, {x:['t'], y:['w', 1]}, '#ff0000');
|
|
plot (r, {x:['w', 0], y:['w', 1]}, '#00ffff');
|
|
delete r.data; /* ukliď po sobě */
|