示例#1
0
def cosh(x, err=defaultError):
    """
    cosh(x [,err]) returns the hyperbolic cosine of x.
    """
    if err <= defaultError:
        series = ExponentialPowerSeries(
            itertools.cycle((
                rational.Integer(1),
                0,
            )))
        rx = rational.Rational(x)
        if rx == 0:
            return rational.Integer(1)
        return series(rx, err)
    else:
        return rational.Rational(math.cosh(x))