Electron Motion in a Electric Field
⚛️ Electron Motion in an Electric Field — Simulated in JavaScript
What happens when an electron is fired horizontally across an electric field? This JavaScript code simulates that motion and shows how acceleration, velocity, and field strength interact — all calculated step by step!
JavaScript Code:
(() => {
// ⚛️ Electron Properties
const masselectron = 9.10938e-28; // g
const chargeElectron = 4.8032e-10; // statC
// ๐ Initial Conditions
const horizVel = 1e09; // cm/s
const horizDist = 2.0; // cm
const downwardAcc = -1e17; // cm/s²
// ⏱️ Time to travel horizontal distance
const timeReqd = horizDist / horizVel;
console.log(`⏱️ Time taken by electron to travel ${horizDist} cm: ${timeReqd.toExponential(2)} s`);
// ๐ Vertical motion due to electric field
const vertDist = 0.5 * downwardAcc * timeReqd ** 2;
const vertVel = downwardAcc * timeReqd;
// ⚡ Electric field calculation
const electricField = Math.abs(downwardAcc) * masselectron / chargeElectron;
console.log(`⚡ Electric field to produce ${downwardAcc.toExponential(2)} cm/s² acceleration: ${(electricField * 299.792458).toFixed(4)} V/m`);
// ๐ Motion Details
console.log(`๐ Vertical distance travelled in ${timeReqd.toExponential(2)} s: ${vertDist.toFixed(4)} cm`);
console.log(`➡️ Horizontal component of velocity: ${horizVel.toExponential(2)} cm/s`);
console.log(`⬇️ Vertical component of velocity: ${vertVel.toExponential(2)} cm/s`);
// ๐ฏ Resultant velocity and angle
const velVector = Math.sqrt(horizVel ** 2 + vertVel ** 2);
const angleWithxAxis = Math.atan2(vertVel, horizVel);
const angleDegs = (180 / Math.PI) * angleWithxAxis;
console.log(`๐ฏ Resultant velocity: ${velVector.toExponential(2)} cm/s`);
console.log(`๐ Angle with x-axis: ${angleDegs.toFixed(4)} degrees`);
})();
๐ง Key Takeaway: Even a relatively small electric field (57 V/m) causes huge acceleration in an electron due to its tiny mass, resulting in noticeable deflection within nanoseconds. Physics meets code — beautifully!
Comments
Post a Comment
Dear Readers, feel free to give your opinion but in a nice way.