mass2 = body.mass ** 2
    return body.speed / mass2 if body.speed > 20 else 20 / mass2

random_thrust_x = RandomVariable(10000, 800000)
random_thrust_y = RandomVariable(10000, 800000)
random_h_1 = RandomVariable(0, -2000)
random_h_2 = RandomVariable(-2000, -2500)
random_h_3 = RandomVariable(-2500, -3000)
random_diameter = RandomVariable(10.0, 15.0)

thrust_x, thrust_y, h_1, h_2, h_3, diameter = monte_carlo_min(
    optimize_monte_carlo,
    random_thrust_x,
    random_thrust_y,
    random_h_1,
    random_h_2,
    random_h_3,
    random_diameter, 
    epsilon=1e-10, limit=100, log=True)


print("Thrust_x: " + str(thrust_x))
print("Thrust_y: " + str(thrust_y))
print("h_0: " + str(h_0))
print("h_1: " + str(h_1))
print("h_2: " + str(h_2))
print("h_3: " + str(h_3))
print("Diameter: " + str(diameter))

body = ShapedBody(POSITION_0,
from algorithms import monte_carlo_min, RandomVariable


def function(x):
    return x * x - 9

x = RandomVariable(0, 5)
print(monte_carlo_min(function, x))