Examples of Complex

@author Edward A. Lee, Jeff Tsay, Steve Neuendorffer, Adam Cataldo @version $Id: Complex.java,v 1.91 2007/12/06 21:57:08 cxh Exp $ @since Ptolemy II 0.2 @Pt.ProposedRating Yellow (eal) @Pt.AcceptedRating Red (cxh)
  • r.data.RComplex.Complex

  • Examples of jscicalc.complex.Complex

        }

        public PopStDev statPopulationStDev(){
      PopStDev stDev = new PopStDev();
      try {
          Complex d = statSumSquares();
          //if( d < 0 || statSize() < 1 ){
          if( statSize() < 1 ){
        stDev.setError( true );
        return stDev;
          } else {
        stDev.setValue( d.divide( new Complex( statSize(), 0 ) ).sqrt() );
        return stDev;
          }
      } catch( Exception e ){
          stDev.setError( true );
          return stDev;
    View Full Code Here

    Examples of jscicalc.complex.Complex

      if( (expression1 instanceof jscicalc.Error) ||
          (expression2 instanceof jscicalc.Error) ){
          return new jscicalc.Error( "Power error" );
      }
      if( expression1 instanceof Complex ){
          Complex v = (Complex)expression1;
          if( expression2 instanceof Complex ){
        Complex w = (Complex)expression2;
        return v.pow( w ); // Complex power of Complex
          }
          Long l = v.isInteger();
          if( l != null ){
        long i = l;
        if( i == 0 ){
            return new jscicalc.Error( "Power error" );
        } else if( i == 1 ){
            return new Complex( 1 );
        } else {
            // integer expression1 as i
        }
          }
      }
      if( expression2 instanceof Complex ){
          Complex w = (Complex)expression2;
          Long m = w.isInteger();
          if( m != null ){
        long n = m;
        // An integer power.
        // Complex values of expression1 should be dealt with separately
        if( n == 0 ) return new Complex( 1 );
        else if( n == 1 ) return expression1;
        else if( expression1 instanceof Power ){
            Power q = (Power)expression1;
            OObject o = null;
            if( q.expression2 instanceof Expression ){
          Product p = new Product( (Expression)(q.expression2), false );
          o = p.multiply( new Complex( n ) );
            } else if( q.expression2 instanceof Complex ){
          o = q.expression2.multiply( new Complex( n ) );
            } else
          return new jscicalc.Error( "Power error" );
            return new Power( q.expression1, o );
        } else if( expression1 instanceof Product ){
            Product p =(Product)expression1;
    View Full Code Here

    Examples of jscicalc.complex.Complex

         */
        public void copy(){
      Object value = calculatorApplet.getValue();
      if( !(value instanceof Complex ) )
          return;
      Complex d = (Complex)value;
      /* get values from CalculatorApplet */
      Base base = calculatorApplet.getBase();
      Notation notation = new Notation();
      double factor = 1;
      if( calculatorApplet.getAngleType() == AngleType.DEGREES )
          factor = 1;//180 / StrictMath.PI;
      String string = d.toHTMLString( maxLength, sigDigits, base, notation, factor );
      /* String now needs formatting */
      java.util.regex.Matcher matcher = html.matcher( string );
      string = matcher.replaceAll( "" );
      matcher = htmlend.matcher( string );
      string = matcher.replaceAll( "" );
    View Full Code Here

    Examples of jscicalc.complex.Complex

          if( o instanceof PObject ){
        PObject p = (PObject)o;
        for( String s : p.name_array() )
            c.add( s );
          } else if( o instanceof Complex ){
        Complex z = (Complex)o;
        String s = Double.toString( z.real() )
            + "+i" + Double.toString( z.imaginary() );
        c.add( s );
          } else ifo instanceof Double ){
        Double d = (Double)o;
        c.add( d.toString() );
          }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * Calculate the inverse.
         * @return The result of the operation
         */
        public OObject inverse(){
      if( this instanceof Expression ){
          return new jscicalc.expression.Power( (Expression)this, new Complex( -1 ) );
      }
      return new Error( "OObject inverse( x ) error" );
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * Calculate the square.
         * @return The result of the operation
         */
        public OObject square(){
      if( this instanceof Expression ){
          return new jscicalc.expression.Power( (Expression)this, new Complex( 2 ) );
      }
      return new Error( "OObject square( x ) error" );
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * Calculate the cube.
         * @return The result of the operation
         */
        public OObject cube(){
      if( this instanceof Expression ){
          return new jscicalc.expression.Power( (Expression)this, new Complex( 3 ) );
      }
      return new Error( "OObject cube( x ) error" );
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * Calculate the square root.
         * @return The result of the operation
         */
        public OObject sqrt(){
      if( this instanceof Expression ){
          return new jscicalc.expression.Power( (Expression)this, new Complex( 0.5 ) );
      }
      return new Error( "OObject sqrt( x ) error" );
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * @return The result of the operation
         */
        public OObject cuberoot(){
      if( this instanceof Expression ){
          return new jscicalc.expression.Power( (Expression)this,
                  new Complex( (double)1 / 3 ) );
      }
      return new Error( "OObject cuberoot( x ) error" );
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * Calculate ten to the power of x.
         * @return The result of the operation
         */
        public OObject tenx(){
      if( this instanceof Expression ){
          return new jscicalc.expression.Power( new Complex( 10 ), (Expression)this );
      }
      return new Error( "OObject tenx( x ) error" );
        }
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. 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.