Calculator/Hamilton/osc.txt

20 lines
437 B
Text
Raw Normal View History

2023-12-02 14:12:25 +01:00
/* 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');