Newton's Laws of Motion Calculator
Calculate force, mass, and acceleration using Newton's Second Law (F=ma). Fundamental physics equation for classical mechanics. Used in engineering, robotics, aerospace.
Visualization
Interactive visualization for Newton's Laws of Motion Calculator
Newton's 2nd Law:
- • F = ma
- • Force equals mass times acceleration
Interactive visualization with step-by-step execution
Implementation
1class NewtonsLaws {
2 calculateForce(mass: number, acceleration: number): number {
3 return mass * acceleration;
4 }
5
6 calculateMass(force: number, acceleration: number): number {
7 if (acceleration === 0) throw new Error('Acceleration cannot be zero');
8 return force / acceleration;
9 }
10
11 calculateAcceleration(force: number, mass: number): number {
12 if (mass === 0) throw new Error('Mass cannot be zero');
13 return force / mass;
14 }
15
16 // Momentum: p = m × v
17 calculateMomentum(mass: number, velocity: number): number {
18 return mass * velocity;
19 }
20
21 // Kinetic Energy: KE = 0.5 × m × v²
22 calculateKineticEnergy(mass: number, velocity: number): number {
23 return 0.5 * mass * velocity * velocity;
24 }
25
26 // Potential Energy: PE = m × g × h
27 calculatePotentialEnergy(mass: number, height: number, g: number = 9.81): number {
28 return mass * g * height;
29 }
30
31 // Work: W = F × d
32 calculateWork(force: number, distance: number): number {
33 return force * distance;
34 }
35}Deep Dive
Theoretical Foundation
Newton's Second Law: F = m×a (Force equals mass times acceleration). F in Newtons, m in kg, a in m/s². First Law: object at rest stays at rest unless acted upon. Third Law: action-reaction pairs. Forms basis of classical mechanics.
Complexity
Time
O(1)
O(1)
O(1)
Space
O(1)
Applications
Industry Use
Automotive engineering (acceleration, braking)
Aerospace design (rocket propulsion)
Structural engineering (load calculations)
Robotics (motor control and movement)
Sports science (biomechanics analysis)
Video game physics engines
Industrial machinery design
Safety systems (crash analysis)
Use Cases
Related Algorithms
GCD (Euclidean Algorithm)
Compute the Greatest Common Divisor (GCD) of two integers using the Euclidean algorithm. Dating back to around 300 BC and appearing in Euclid's Elements, it's one of the oldest algorithms still in common use. The algorithm is based on the principle that GCD(a,b) = GCD(b, a mod b) and is remarkably efficient with O(log min(a,b)) time complexity. The GCD is the largest positive integer that divides both numbers without remainder.
LCM (Least Common Multiple)
Calculate the Least Common Multiple (LCM) of two integers - the smallest positive integer that is divisible by both numbers. The LCM is intimately related to the GCD through the formula: LCM(a,b) = |a×b| / GCD(a,b). This relationship allows us to compute LCM efficiently using the Euclidean algorithm for GCD, achieving O(log min(a,b)) time complexity instead of naive factorization methods.
Sieve of Eratosthenes
Ancient and highly efficient algorithm to find all prime numbers up to a given limit n. Invented by Greek mathematician Eratosthenes of Cyrene (276-194 BC), this sieve method systematically eliminates multiples of primes, leaving only primes in the array. With O(n log log n) time complexity, it remains one of the most practical algorithms for generating large lists of primes, vastly superior to trial division which runs in O(n² / log n) time.
Prime Factorization
Decompose a positive integer into its unique prime factor representation. Every integer greater than 1 can be expressed as a product of prime numbers in exactly one way (Fundamental Theorem of Arithmetic). This algorithm uses trial division optimized to check only up to √n, as any composite number must have a prime factor ≤ √n. Returns a map of prime factors to their powers, e.g., 360 = 2³ × 3² × 5¹.