Class Psi


  • public class Psi
    extends java.lang.Object

    This code calculates the psi function of an input argument x.

    A typical real variable usage would be:
     double result[] = new double[1];
     Psi psiTest = new Psi(5.0, result);
     psiTest.run();
     Preferences.debug("Psi(5.0) = " + result[0] + "\n");
     UI.setDataText("Psi(5.0) = " + result[0] + "\n");
     

    A typical complex variable usage would be:

     double realResult[] = new double[1];
     double imagResult[] = new double[1];
     Psi psiTest = new Psi(5.0, -1.0, realResult, imagResult);
     psiTest.run();
     Preferences.debug("Psi(5.0,-1.0) = " + realResult[0] + ", " + imagResult[0] + "\n");
     

    The FORTRAN code this class is based upon is from Computation of Special Functions by Shanjie Zhang and Jianming Jin and copyright 1996 John Wiley & Sons, Inc.

    From the diskette that the FORTRAN code came on:

     DISCLAIMER OF WARRANTY
     
     Although we have made a great effort to test and validate the 
     computer programs, we make no warranties, express or implied, that 
     these  programs  are  free  of  error,  or are consistent with any 
     particular  standard  of  merchantability,  or that they will meet 
     your requirements for any particular application.  They should not 
     be relied on for  solving problems  whose incorrect solution could 
     result in  injury to  a person or loss of property.  If you do use 
     the programs in such a manner, it is at your own risk. The authors 
     and publisher  disclaim all liability for  direct or consequential 
     damages resulting from your use of the programs.
     
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int COMPLEX_VERSION  
      private double[] imagResult
      Imaginary part of output result
      private double imagX
      Imaginary part of input argument
      static int REAL_VERSION  
      private double[] realResult
      Real part of output result
      private double realX
      Real part of input argument
      private double[] result
      output result
      private int version
      REAL_VERSION or COMPLEX_VERSION
      private double x
      input argument
    • Constructor Summary

      Constructors 
      Constructor Description
      Psi()  
      Psi​(double x, double[] result)  
      Psi​(double realX, double imagX, double[] realResult, double[] imagResult)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void complexPsi()
      This code is a port of the FORTRAN routine CPSI from the book Computation of Special Functions by Shanjie Zhang and Jianming Jin, John Wiley & Sons, Inc., 1996, pp. 59-60.
      void finalize()
      Cleanup memory.
      void realPsi()
      This code is a port of the FORTRAN routine PSI from the book Computation of Special Functions by Shanjie Zhang and Jianming Jin, John Wiley & Sons, Inc., 1996, pp. 58-59.
      void run()  
      void testcomplexPsi()  
      void testrealPsi()  
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • x

        private double x
        input argument
      • result

        private double[] result
        output result
      • version

        private int version
        REAL_VERSION or COMPLEX_VERSION
      • realX

        private double realX
        Real part of input argument
      • imagX

        private double imagX
        Imaginary part of input argument
      • realResult

        private double[] realResult
        Real part of output result
      • imagResult

        private double[] imagResult
        Imaginary part of output result
    • Constructor Detail

      • Psi

        public Psi()
      • Psi

        public Psi​(double x,
                   double[] result)
        Parameters:
        x - Input argument
        result - outputted psi(x)
      • Psi

        public Psi​(double realX,
                   double imagX,
                   double[] realResult,
                   double[] imagResult)
        Parameters:
        realX - real part of input argument
        imagX - imaginary part of input argument
        realResult - real part of outputted psi(x)
        imagResult - imaginary part of outputted psi(x)
    • Method Detail

      • finalize

        public void finalize()
                      throws java.lang.Throwable
        Cleanup memory.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable - DOCUMENT ME!
      • run

        public void run()
      • testrealPsi

        public void testrealPsi()
      • testcomplexPsi

        public void testcomplexPsi()
      • realPsi

        public void realPsi()
        This code is a port of the FORTRAN routine PSI from the book Computation of Special Functions by Shanjie Zhang and Jianming Jin, John Wiley & Sons, Inc., 1996, pp. 58-59.
      • complexPsi

        public void complexPsi()
        This code is a port of the FORTRAN routine CPSI from the book Computation of Special Functions by Shanjie Zhang and Jianming Jin, John Wiley & Sons, Inc., 1996, pp. 59-60.