/** * Returns the hyberbolic sine of this complex number. * @return the hyberbolic sine. */ public Cfloat sinh() { return sinh(this); }
/** * Returns the hyperbolic tangent of a complex number. * @param x a complex number. * @return the hyperbolic tangent. */ public static Cfloat tanh(Cfloat x) { return sinh(x).overEquals(cosh(x)); }
/** * Returns the hyperbolic sine of a complex number. * @param x a complex number. * @return the hyperbolic sine. */ public static Cfloat sinh(Cfloat x) { return new Cfloat(sinh(x.r)*cos(x.i),cosh(x.r)*sin(x.i)); }
/** * Returns the cosine of a complex number. * @param x a complex number. * @return the cosine. */ public static Cfloat cos(Cfloat x) { return new Cfloat(cos(x.r)*cosh(x.i),-sin(x.r)*sinh(x.i)); }
/** * Returns the hyperbolic cosine of a complex number. * @param x a complex number. * @return the hyperbolic cosine. */ public static Cfloat cosh(Cfloat x) { return new Cfloat(cosh(x.r)*cos(x.i),sinh(x.r)*sin(x.i)); }
/** * Returns the sine of a complex number. * @param x a complex number. * @return the sine. */ public static Cfloat sin(Cfloat x) { return new Cfloat(sin(x.r)*cosh(x.i),cos(x.r)*sinh(x.i)); }
public void test() { Cfloat a = new Cfloat(FLT_PI,FLT_E); Cfloat b = new Cfloat(FLT_E,FLT_PI); assertEquals(a,sub(add(a,b),b)); assertEquals(a,div(mul(a,b),b)); assertEquals(a,conj(conj(a))); assertEquals(a,polar(abs(a),arg(a))); assertEquals(a,exp(log(a))); assertEquals(a,pow(sqrt(a),2.0f)); assertEquals(pow(a,b),exp(b.times(log(a)))); assertEquals(pow(a,b),exp(b.times(log(a)))); assertEquals(sin(FLT_I.times(a)), FLT_I.times(sinh(a))); assertEquals(cos(FLT_I.times(a)),cosh(a)); assertEquals(tan(FLT_I.times(a)), FLT_I.times(tanh(a))); }