def mag(f, u=None, v=None):
    """returns the magnification value (without the sign) from focal-length
    and either one of the value of object or image distance

    Parameters
    ----------
    f : float
        focal length
    u : float, optional
        object distance
    v : float, optional
        image distance

    Returns
    -------
    m : float
        magnification (without the sign)
    """
    if v is not None:
        return (v - f)/f
    else:
        return f/(u - f)