Scheme Exercises
back to exercise list
previous next
Group: Exercise: 39/48
Newton's Gravity:
Calculate the force between two objects using Newton's Law of Gravity
Create a function "gravity" that returns the force calculated by Newton's law of gravity. (gravity 1 2 3) => 1.483111111111111e-011 (gravity 1000 2000 10) => 1.3347999999999997e-006 Newton's Law of Gravity allows us to calculate the gravitational force between two objects as follows: Force = (G * m1 * m2) / (r^2) G is a constant defined as 6.674 * 10^-11 , which can be written as 6.674e-11 in scheme. (You MUST use this value!) m1, m2, and r are the numeric variables.
|