Created
December 15, 2019 03:17
-
-
Save jiggzson/d6fa2599293ef32df676f9efc2ec2af9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
https://sciencenotes.org/projectile-motion-example-problem-physics-homework-help/ | |
A cannon is fired with muzzle velocity of 150 m/s at an angle of elevation = 45°. Gravity = 9.8 m/s2. | |
a) What is the maximum height the projectile reaches? | |
b) What is the total time aloft? | |
c) How far away did the projectile land? (Range) | |
d) Where is the projectile at 10 seconds after firing? | |
*/ | |
var knowns = { | |
v0: 150, // m/s | |
theta: 45, // deg | |
g: 9.8 // m/s^2 | |
}; | |
//assuming degrees | |
var eqs = { | |
vx: 'v0*cos(radians(theta))', | |
vy: 'v0*sin(radians(theta))-g*t', | |
x: 'v0*t*cos(radians(theta))', | |
range: 'v0*t_total*cos(radians(theta))', | |
y: 'v0*t*sin(radians(theta))-0.5*g*t^2' | |
}; | |
//at the top velocity is zero so we can add that to the knowns | |
var t = nerdamer(eqs.vy, knowns).solveFor('t')[0]; | |
console.log(`time: ${t.text()} seconds`); | |
knowns.t = t; | |
// a) | |
var max_height = nerdamer(eqs.y, knowns).evaluate().text(); | |
console.log(`max height: ${max_height} meters`); | |
// b) | |
var time_aloft = nerdamer(knowns.t).multiply(2).evaluate().text(); | |
console.log(`time aloft: ${time_aloft} seconds`); | |
//make a note of total time in the air | |
knowns.t_total = time_aloft; | |
// c) | |
var Range = nerdamer(eqs.range, knowns).evaluate().text(); | |
console.log(`Range: ${Range} meters`); | |
// d) | |
knowns.t = 10; | |
var x10 = nerdamer(eqs.x, knowns).evaluate().text(); | |
var y10 = nerdamer(eqs.y, knowns).evaluate().text(); | |
console.log(`At 10 seconds: x is ${x10} meters and y is ${y10} meters`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment