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

         * @param b The Base
         * @return The number as a double
         * @see Parser
         */
        public static Complex parseString( String s, Base b ){
      return new Complex( dparseString( s, b ) );
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

        /**
         * Construct a Product.
         */
        public Product(){
      complex = new Complex(); //zero
      expressionList = new java.util.LinkedList<Expression>();
      divisorList = new java.util.LinkedList<Expression>();
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * Create a copy of this Product.
         * @return a copy of this
         */
        public Product clone(){
      Product copy = new Product();
      copy.complex = new Complex( complex.real(), complex.imaginary() );
      copy.expressionList = new java.util.LinkedList<Expression>();
      for( java.util.ListIterator<Expression>
         i = getExpressionList().listIterator(); i.hasNext(); ){
          copy.expressionList.add( i.next() );
      }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * for a single object.
         * @return simplified expression
         */
        public OObject unBox(){
      if( divisorList.isEmpty() && expressionList.size() == 1 &&
          complex.subtract( new Complex( 1 ) ).isZero() ){
          return expressionList.getFirst();
      } else if( divisorList.isEmpty() && expressionList.isEmpty() ){
          return complex;
      } else {
          return this;
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * non-integer powers.
         * @param n The integer (actually a long)
         * @return An integer power
         */
        OObject integer_power( long n ){
      Complex z = new Complex( n );
      Product result = new Product();
      result.complex = complex.pow( z );
      for( java.util.ListIterator<Expression> i = expressionList.listIterator();
           i.hasNext(); ){
          Expression e = i.next();
    View Full Code Here

    Examples of jscicalc.complex.Complex

        public OObject auto_simplify(){
      // first remove quotients
      for( java.util.ListIterator<Expression> i = divisorList.listIterator();
           i.hasNext(); ){
          Expression e = i.next();
          OObject o = new Power( e, new Complex( -1 ) ).auto_simplify();
          if( o instanceof Complex ){
        complex = complex.divide( (Complex)o );
          } else if( o instanceof Expression ){
        expressionList.add( (Expression)o );
          } else {
        return new jscicalc.Error( "Product.auto_simplify() error" );
          }
      }
      divisorList.clear();
      // simplify remaining expressions
      for( java.util.ListIterator<Expression> i = expressionList.listIterator();
           i.hasNext(); ){
          OObject o = i.next().auto_simplify();
          if( o instanceof Complex ){
        complex = complex.multiply( (Complex)o );
        i.remove();
          } else if( o instanceof Expression ){
        i.set( (Expression)o );
          } else {
        return new jscicalc.Error( "Product.auto_simplify() error" );
          }
      }
      sort();
      if( expressionList.isEmpty() ) return unBox(); // should be a Complex
      // now work through expressions in product
      java.util.ListIterator<Expression> i = expressionList.listIterator();
      Expression f = null; // initialise for loop
      for( Expression e = i.next(); i.hasNext(); e = f ){
          OObject base_e = e;
          OObject exponent_e = new Complex( 1 );
          if( e instanceof Power ){
        base_e = ((Power)e).base();
        exponent_e = ((Power)e).exponent();
          }
          f = i.next();
          OObject base_f = f;
          OObject exponent_f = new Complex( 1 );
          if( f instanceof Power ){
        base_f = ((Power)f).base();
        exponent_f = ((Power)f).exponent();
          }
          if( base_e.compareTo( base_f ) == 0 ){
    View Full Code Here

    Examples of jscicalc.complex.Complex

      if( expression instanceof Sum ){
          Sum sum = (Sum)expression;
          complex = sum.complex;
          expressionList = sum.expressionList;
      }
      complex = new Complex(); //zero
      expressionList = new java.util.LinkedList<Expression>();
      expressionList.add( expression );
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

       
        /**
         * Construct a Sum.
         */
        public Sum(){
      complex = new Complex(); //zero
      expressionList = new java.util.LinkedList<Expression>();
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * Create a copy of this Sum.
         * @return a copy of this
         */
        public Sum clone(){
      Sum copy = new Sum();
      copy.complex = new Complex( complex.real(), complex.imaginary() );
      copy.expressionList = new java.util.LinkedList<Expression>();
      for( java.util.ListIterator<Expression>
         i = getExpressionList().listIterator(); i.hasNext(); ){
          copy.expressionList.add( i.next() );
      }
    View Full Code Here

    Examples of jscicalc.complex.Complex

          if( !(getApplet().getValue() instanceof Complex) ){
        getApplet().requestFocusInWindow();
        return;
          }
          getApplet().pushHistory();
          Complex value = (Complex)(getApplet().getValue());
          if( getApplet().getMode() != 0 ){
        getApplet().setMode( pobject );
        getApplet().requestFocusInWindow();
        return;
          }
    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.