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`);
})();
⏱️ Time taken by electron to travel 2 cm: 2.00e-9 s
⚡ Electric field to produce -1.00e+17 cm/s² acceleration: 56.8563 V/m
๐Ÿ“‰ Vertical distance travelled in 2.00e-9 s: -0.2000 cm
➡️ Horizontal component of velocity: 1.00e+9 cm/s
⬇️ Vertical component of velocity: -2.00e+8 cm/s
๐ŸŽฏ Resultant velocity: 1.02e+9 cm/s
๐Ÿ“ Angle with x-axis: -11.3099 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

Popular posts from this blog

Normality Calculator for Standard Acids

✈️ Jet Takeoff Physics Simulator – Interactive Post