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

        getApplet().setMode( 0 );
        getApplet().setShift( false );
          }
          getApplet().setOn( true );
          getApplet().clear();
          getApplet().setValue( new Complex( 0 ) );
          getApplet().updateDisplay( true, true );
          getApplet().requestFocusInWindow();
      }
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * @param x The value (right of symbol)
         * @return The result of the operation
         */
        public OObject function( OObject x ){
      if( x instanceof Complex ){
          Complex c = (Complex)x;
          if( scale != 1 && StrictMath.abs( c.imaginary() ) > 1e-6 )
        throw new RuntimeException( "Error" );
          return c.scale( scale ).cos();
      } else {
          return x.cos( angleType );
      }
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * @param x The value (right of symbol)
         * @return The result of the operation
         */
        public OObject function( OObject x ){
      if( x instanceof Complex ){
          Complex c = (Complex)x;
          if( scale != 1 && StrictMath.abs( c.imaginary() ) > 1e-6 )
        throw new RuntimeException( "Error" );
          return c.scale( scale ).tan();
      } else {
          return x.tan( angleType );
      }
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

      /* intitially no attached component  and no graph */
      setTextComponent( null );
      graph = null;

      /* set initial value */
      setValue( new Complex() );

      /* set initial sizes */
      setSizes();
     
      /* set initial state */
      parser = new Parser();
      shift = false;
      angleType = AngleType.DEGREES;
      mode = 0;
      stat = false;
      notation = new Notation(); // set default of standard, rectangular, non-complex
      memory = new Complex();
      statMemory = new java.util.Vector<Complex>();
      statMemoryNeg = new java.util.Vector<Complex>();

      //listen for key presses
      addKeyListener( this );
      setFocusable( true );

            getContentPane().removeAll();
     
      /* set up initial objects */
      displayPanel = new DisplayPanel( this );
      displayPanel
          .setBorder( new javax.swing.border
          .BevelBorder( javax.swing.border.BevelBorder.LOWERED ) );
      setPanels();

      /* create a DataTransfer so we can copy to system clipboard */
      /* this code does not actually work -- I don't know why */
      dataTransfer = new DataTransfer( this );
      calculatorPanel.getInputMap()
          .put( javax.swing.KeyStroke
          .getKeyStroke( java.awt.event.KeyEvent.VK_COPY, 0), "copy" );
      calculatorPanel.getInputMap()
          .put( javax.swing.KeyStroke
          .getKeyStroke( java.awt.event.KeyEvent.VK_C,
             java.awt.event.ActionEvent.CTRL_MASK |
             java.awt.event.ActionEvent.SHIFT_MASK, false  ),
          "copy" );
      calculatorPanel.getActionMap().put( "copy", dataTransfer );
      dataTransfer.setEnabled( true );
     
      //set up history
     
      setBase( Base.DECIMAL );
      history = new java.util.Vector<HistoryItem>();
      tempParserList
          = new HistoryItem( null, getAngleType(), getBase(), getNotation() );
      historyPosition = -1;
      shiftDown = false;
      setOn( true );
      setValue( new Complex( 0 ) );
      updateDisplay( true, true );
      requestFocusInWindow();
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

      if( historyPosition >= history.size() - 1 ) return;
      // save old buffer
      if( historyPosition == -1 ){
          // if error shown clear it.
          if( getValue() instanceof jscicalc.Error )
        setValue( new Complex() );
          // copy to temporary buffer
          tempParserList.list = parser.getList();
          tempParserList.angleType = getAngleType();
          tempParserList.base = getBase();
          tempParserList.notation = getNotation();
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * @param d The Complex to put into memory
         * @return The number of objects in statistical memory.
         */
        public Complex statAdd( Complex d ){
      statMemory.add( d );
      return new Complex( statSize() );
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

         * @return The number of objects in statistcal memory.
         * @see #statAdd( Complex )
         */
        public Complex statSub( Complex d ){
      statMemoryNeg.add( d );
      return new Complex( statSize() );
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

      return statMemory.size() - statMemoryNeg.size();
        }

        public Mean statMean(){
      Mean mean = new Mean();
      Complex d = new Complex();
      for( Complex o : statMemory ){
          d = d.add( o );
      }
      for( Complex o : statMemoryNeg ){
          d = d.subtract( o );
      }
      if( statSize() > 0 ){
         mean.setValue( d.divide( new Complex( statSize(), 0 ) ) );
      } else {
          mean.setError( true );
       }
      return mean;
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

       
        public Complex statSumSquares(){
      Mean m = statMean();
      if( m.error() || !(m.value() instanceof Complex) )
          throw new RuntimeException( "Stat Error" );
      Complex e = (Complex)(m.value());
      Complex d = new Complex();
      for( Complex o : statMemory ){
          Complex c = o.subtract( e );
          d = d.add( c.square() );
      }
      for( Complex o : statMemoryNeg ){
          Complex c = o.subtract( e );
          d = d.subtract( c.square() );
      }
      return d;
        }
    View Full Code Here

    Examples of jscicalc.complex.Complex

        }

        public StDev statSampleStDev(){
      StDev stDev = new StDev();
      try {
          Complex d = statSumSquares();
          //if( d < 0 || statSize() < 2 ){
          if( statSize() < 2 ){
        stDev.setError( true );
        return stDev;
          } else {
        stDev.setValue( d.divide( new Complex( statSize() - 1, 0 ) ).sqrt() );
        return stDev;
          }
      } catch( Exception e ){
          stDev.setError( true );
          return stDev;
    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.