def METHOD_NAME(gam_init, prob, complex_step=False):
    """
    Compute distance given initial speed and angle of cannonball.
    Parameters
    ----------
    gam_init : float
        Initial cannonball firing angle in degrees.
    prob : <Problem>
        OpenMDAO problem that contains the equations of motion.
    complex_step : bool
        Set to True to perform complex step.
    Returns
    -------
    float
        Negative of range in m.
    """
    dt = 0.1        # Time step
    h_init = 1.0    # Height of cannon.
    v_init = 100.0  # Initial cannonball velocity.
    h_target = 0.0  #
    v = v_init
    gam = gam_init
    h = h_init
    r = 0.0
    t = 0.0
    if complex_step:
        prob.set_complex_step_mode(True)
    while h > h_target:
        # Set values
        prob.set_val('v', v)
        prob.set_val('gam', gam, units='deg')
        # Run the model
        prob.run_model()
        # Extract rates
        v_dot = prob.get_val('v_dot')
        gam_dot = prob.get_val('gam_dot', units='deg/s')
        h_dot = prob.get_val('h_dot')
        r_dot = prob.get_val('r_dot')
        h_last = h
        r_last = r
        # Euler Integration
        v = v + dt * v_dot
        gam = gam + dt * gam_dot
        h = h + dt * h_dot
        r = r + dt * r_dot
        t += dt
        # print(v, gam, h, r)
    # Linear interpolation between last two points to get the landing point accurate.
    r_final = r_last + (r - r_last) * h_last / (h_last - h)
    if complex_step:
        prob.set_complex_step_mode(False)
    #print(f"Distance: {r_final}, Time: {t}, Angle: {gam_init}")
    return -r_final