def rupture_force_from_dpdf(dpdf, forces, force_step=None):
    """Calculate the average rupture force for a given probability
    density and the associated force values by numerical integration.

    *f_ext* (the theoretical external force for a rigid molecule) is defined
    by f_ext = 'spring constant' * 'velocity'  * 'time' + 'initial force'
    or the real external force for zero sping constant.

    Parameters
    ----------
    dpdf: list of floats
        dp/df-values for each *f_ext*-value.
    forces: list of floats
        External forces for each *f_ext*.
    force_step: float (optional)
        Step size of *f_ext*.

    Returns
    -------
    result: float
        Rupture force.

    """
    if force_step is None:
        force_step = forces[1] - forces[0]
        for i in range(2, len(forces)):
            if abs(force_step - (forces[i] - forces[i - 1])) > 1e-06:
                raise ValueError('The force steps in list forces should ' +
                    'be constant.')
    integration1 = 0.0
    integration2 = 0.0
    for i in range(len(dpdf)):
        integration1 += dpdf[i] * force_step * forces[i]
        integration2 += dpdf[i] * force_step
    return integration1 / integration2
