Posts

Showing posts with the label coding

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 / chargeE...