Calculator/Hamilton/railgun.txt

34 lines
778 B
Text
Raw Permalink Normal View History

2023-12-02 14:12:25 +01:00
const m = 0.0007, mu = 1.2e-6, C = 0.020, U0 = 250.0, R = 0.01;
/* {t:t , w:[ x, p_x, Q , p_Q]}*/
let bc = {t:0.0, w:[0.2, 0.0, C * U0, 0.0]}
let ls = [
(z) => {
const p_x = z.w[1];
return p_x / m;
},
(z) => {
const x = z.w[0];
const p_Q = z.w[3];
const d = p_Q / x;
return 0.5 * d * d / mu;
},
(z) => {
const x = z.w[0];
const p_Q = z.w[3];
return p_Q / (mu * x);
},
(z) => {
const x = z.w[0];
const Q = z.w[2];
const p_Q = z.w[3];
const Rp = - (R * p_Q) / (mu * x);
return Rp - Q/C;
},
];
let r = solve (5.0e-7, 2000, bc, ls); /* řešení */
plot (r, {x:['t'], y:['w', 1]}, '#00ff00');
plot (r, {x:['t'], y:['w', 3]}, '#ff0000');
2023-12-03 14:50:32 +01:00
delete r.data; /* ukliď po sobě */
2023-12-02 14:12:25 +01:00