/** * Return the cos of a complex number * * @param num the tanh of a complex number * @return the tanh of a complex number */ public static IComplexNumber cos(IComplexNumber num) { Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).cos(); return Nd4j.createDouble(c.getReal(), c.getImaginary()); }
/** * Return the cos of a complex number * * @param num the tanh of a complex number * @return the tanh of a complex number */ public static IComplexNumber cos(IComplexNumber num) { Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).cos(); return Nd4j.createDouble(c.getReal(), c.getImaginary()); }
Complex first = new Complex(1.0, 3.0); Complex second = new Complex(2.0, 5.0); Complex answer = first.log(); // natural logarithm. answer = first.cos(); // cosine answer = first.pow(second); // first raised to the power of second
/** * c = cos(a) * * @param a * a * @param c * c */ public static void complexCos(GeoVec2D a, GeoVec2D c) { Complex out = new Complex(a.x, a.y); out = out.cos(); c.x = out.getReal(); c.y = out.getImaginary(); c.setMode(Kernel.COORD_COMPLEX); }
public ValueType cos(CalculatedValue g) { if (g.isComplex()) { return setComplexValue(g.getComplex().cos()); } else { return setValue(FastMath.cos(g.real)); } }
/** * c = sec(a) * * @param a * a * @param c * c */ public static void complexSec(GeoVec2D a, GeoVec2D c) { Complex out = new Complex(a.x, a.y); out = Complex.ONE.divide(out.cos()); c.x = out.getReal(); c.y = out.getImaginary(); c.setMode(Kernel.COORD_COMPLEX); }
public ValueType sec(CalculatedValue g) { if (g.isComplex()) { return setComplexValue(g.getComplex().cos().reciprocal()); } else { return setValue(1.0f / FastMath.cos(g.real)); } }
ComplexFormat cf = new ComplexFormat(); Complex c = cf.parse("1.110 + 2.222i"); Complex second = new Complex(2.0, 5.0); Complex answer = c.log(); // natural logarithm. answer = c.cos(); // cosine answer = c.pow(second); // first raised to the power of second ComplexFormat format = new ComplexFormat(); // default format String s1 = format.format(c); // s1 contains "1.110 + 2.222i" String s2 = format.format(second); // s2 contains "2.0 + 5.0i"
/** * Numerical cosine. * * @param complex argument * @return cosine */ public static Complex cos(Complex complex) { if (complex.isReal()) return new Complex(FastMath.cos(complex.getReal().doubleValue())); return new Complex(new org.apache.commons.math3.complex.Complex(complex.getReal().doubleValue(), complex.getImaginary().doubleValue()).cos()); }