Package org.zkoss.zss.engine

Examples of org.zkoss.zss.engine.Complex


      suffix = args[2].toString();     
    }
    if(Double.isNaN(real) || Double.isNaN(imaginary) || (suffix!="i" && suffix!="j")) {
      throw new SSErrorXelException(SSError.VALUE);
    }
    return new Complex(real, imaginary, suffix);
  }
View Full Code Here


   * @param args the arguments; only args[0](inumber) is significant.
   * @param ctx the function context.
   * @return the argument theta, an angle expressed in radians.
   */
  public static Object engineerImargument(Object[] args, XelContext ctx) {
    Complex inumber = UtilFns.validateComplex(args[0].toString());
    double real = inumber.getReal();
    double img = inumber.getImaginary();
    /* original math formula:
     * theta = arc tangent(img/real)
     * but since MSFT IMARGUMENT() return value is (-pi, pi]
     *           java.lang.math atan() return value is (-pi/2, pi/2]
     * so instead use atan2()
View Full Code Here

   * @param args the arguments; only args[0] is significant.
   * @param ctx the function context.
   * @return the complex conjugate of a complex number.
   */
  public static Object engineerImconjugate(Object[] args, XelContext ctx) {
    Complex complex = UtilFns.validateComplex(args[0].toString());
    return UtilFns.cToComplex(complex.conjugate(), complex.getSuffix());
  }
View Full Code Here

   * @param args the arguments; only args[0] is significant.
   * @param ctx the function context.
   * @return the cosine of a complex number.
   */
  public static Object engineerImcos(Object[] args, XelContext ctx) {
    Complex complex = UtilFns.validateComplex(args[0].toString());
    return UtilFns.cToComplex(complex.cos(), complex.getSuffix());
  }
View Full Code Here

   * @param args the arguments; only args[0](inumber) is significant.
   * @param ctx the function context.
   * @return the exponential of a complex number.
   */
  public static Object engineerImexp(Object[] args, XelContext ctx) {
    Complex complex = UtilFns.validateComplex(args[0].toString());
    String suffix = complex.getSuffix();
    return UtilFns.cToComplex(new Complex(Math.E, 0, suffix).pow(complex), suffix);
  }
View Full Code Here

   * @param args the arguments; only args[0](inumber) is significant.
   * @param ctx the function context.
   * @return the natural logarithm of a complex number.
   */
  public static Object engineerImln(Object[] args, XelContext ctx) {
    Complex complex = UtilFns.validateComplex(args[0].toString());
    return UtilFns.cToComplex(complex.log(), complex.getSuffix());
  }
View Full Code Here

   * @param args the arguments; only args[0])(inumber) is significant.
   * @param ctx the function context.
   * @return the base-10 logarithm of a complex number.
   */
  public static Object engineerImlog10(Object[] args, XelContext ctx) {
    Complex complex = UtilFns.validateComplex(args[0].toString());
    String suffix = complex.getSuffix();
    return UtilFns.cToComplex(complex.log().divide(new Complex(10, 0, suffix).log()), suffix);
  }
View Full Code Here

   * @param args the arguments; only args[0](inumber) is significant.
   * @param ctx the function context.
   * @return the base-2 logarithm of a complex number.
   */
  public static Object engineerImlog2(Object[] args, XelContext ctx) {
    Complex complex = UtilFns.validateComplex(args[0].toString());
    String suffix = complex.getSuffix();
    return UtilFns.cToComplex(complex.log().divide(new Complex(2, 0, suffix).log()), complex.getSuffix());
  }
View Full Code Here

   * @param args the arguments; only args[0] is significant.
   * @param ctx the function context.
   * @return the sine of a complex number.
   */
  public static Object engineerImsin(Object[] args, XelContext ctx) {
    Complex complex = UtilFns.validateComplex(args[0].toString());
    return UtilFns.cToComplex(complex.sin(), complex.getSuffix());
  }
View Full Code Here

   * @param args the arguments; only args[0] is significant.
   * @param ctx the function context.
   * @return the square root of a complex number.
   */
  public static Object engineerImsqrt(Object[] args, XelContext ctx) {
    Complex complex = UtilFns.validateComplex(args[0].toString());
    return UtilFns.cToComplex(complex.sqrt(), complex.getSuffix());
  }
View Full Code Here

TOP

Related Classes of org.zkoss.zss.engine.Complex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.