Skip to content

Instantly share code, notes, and snippets.

@Basanites
Last active November 13, 2017 20:58
Show Gist options
  • Select an option

  • Save Basanites/7b086a55f8a01ef53b9ea082615a3f1e to your computer and use it in GitHub Desktop.

Select an option

Save Basanites/7b086a55f8a01ef53b9ea082615a3f1e to your computer and use it in GitHub Desktop.
Physics assignment solution
import math
g = 9.81
m = 1.0
v = g * math.sqrt(2 / g)
def blast(n):
if n == 1:
return v
else:
return (2 * (m / math.pow(10, n - 2)) * blast(n - 1) - (m / math.pow(10, n - 1)) * v + (
m / math.pow(10, n - 2)) * v) / ((m / math.pow(10, n - 2)) + (m / math.pow(10, n - 1)))
x = 2
while (blast (x) < 11200):
x += 1
print("\n", blast(x), "\n", x, "\n\n", blast(x-1), "\n", x - 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment