Solving Physics Problems

Lets see if we can use math in JavaScript to Solve for physics problems

A car moves with a constant acceleration of 2.00 m/s² along a straight line from point A to point B starting from a speed of 5.00 m/s, taking 10 seconds. What distance does the car travel assuming the place where the car starts is the point of reference?

function solve(Δx) {
    var t = 10 // Variable t represents time
    var a = 2 // Variable a represents acceleration
    var vᵢ = 5 // Variable v represents the initial velocity
    var Δx = (vᵢ * t) + (0.5 * a * Math.pow(t, 2)) // Kinematic Equation for position as a function of time
}

function logIt() {
    console.log("Use the kinematic equation Δx = vᵢt + at²");
    console.log("plug in the known values: Δx = (5)(10) + (2)(10)²");
    console.log("The car travels", Δx, "meters");
}

logIt()
Use the kinematic equation Δx = vᵢt + at²
plug in the known values: Δx = (5)(10) + (2)(10)²
The car travels 150 meters