Skip to main content

Finding all roots of a nonlinear function

Submitted by deepaktrivedi on

I need to find all possible roots of a nonlinear function in six
variables y = f(x_1,x_2,x_3,x_4,x_5,x_6), where 0 <= x_i <=
x_max. The function is not available in closed form. I saw there are
some methods available (e.g., http://www.springerlink.com/content/y8g01h854693g876/). Could someone point me to a code I can directly use ?



Regards,

Deepak

a FORTRAN code to compute the root is:

---------------------------------------------------

     SUBROUTINE GETPORT_MRF(STS,STSA,STS_INC,SDT,PORTION,TEMP0,TEMP,

     &                           DTEMP,PSI,PROPS,NPROPS,CMTX1,FYD0,FYD,

     &                           ALPDIF,ALPH,BETA,GAMA,IPHASE, IRULE)

     

      IMPLICIT REAL*8 (A-H,O-Z)             

      COMMON /DATASPA01/ ISPA, NSS, IMETH, MAXNSS, ICORRECT, MAXCORR,

     &                               IPORT,MAXPORT

      COMMON /DATASPA02/ TOLR, TOLC, TOLPORT

      DIMENSION STS(6),STSA(6),STS_INC(6),Q(6),RL(6),SDT(6),

     &     CMTX1(6,6),ALPDIF(3),PROPS(NPROPS)

c

c      Chen Xi, NUS, 2008.10.

c      Reference : Dowell M, Jarratt P. A modified Regula Falsi method for Computing

c                        the root of an equation.

c     *********************** A   R   R   A   Y   s ********************

   

c       IPHASE     : The phase of the material: 1 - Austenite, 2 - Martensite ;

c         IRULE     : Flag for the form of the transformation tensor, Lambda:

c                         1 - given by equation (5), 2 - given by equation (7);

c        RL(6)      : Transformation tensor .

c  ALPH (i.e. H)  : Maximum recoverable transformation strain.

      TMP = TEMP ;

      DTMP = DTEMP ;

      PORTION0 = 0.D0 ;

      PORTION1 = 1.D0 ;

      FYD1 = FYD ;

      ! Fsave =  FYD0 ;

      DO IT = 1, MAXPORT

             PORTION = PORTION1 - (PORTION1-PORTION0)*FYD1/(FYD1-FYD0) ;

             STS = STSA + PORTION*STS_INC ;

             TMP = TEMP + PORTION*DTMP ;         ! present TEMPERATURE  !@@?

             DTMP0 = TMP - TEMP0 ;   ! present TEMPERATURE - To       

             CALL GETRL(RL,STS,SDT,ALPH,BETA,GAMA,IPHASE, IRULE) ;

             CALL YDFUN(FYD,STS,SDT,RL,TMP,DTMP0,PSI,PROPS,IPHASE,

     &                           CMTX1,ALPDIF,NPROPS) ;

             IF( DABS(FYD) < TOLPORT )EXIT

             IF( FYD*FYD1 < 0.D0 )THEN    ! DIFFERENT SIGN ;

                   PORTION0 = PORTION1 ;

                   FYD0 = FYD1 ;

                   PORTION1 = PORTION ;

                   FYD1 = FYD ;

             ELSE

                   PORTION1 = PORTION ;

                   FYD1 = FYD ;

                   !

                   FYD0=FYD0/2.D0 ; ! FOR SAME SIGN ;

                   ! PORTION0 = PORTION0 ;

             END IF

      END DO

c      Write(*,*) " when exit MRF, IT = ", IT 

c

      RETURN

c     

      END 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

References:

A modified regula falsi method for computing the root of an equation, M Dowell, 1971.

The "Pegasus" method for computing the root of anequation, P. Jarratt, 1972.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A slow method is to scan each small divided interval using the bounded iterative method.

The only difference for the above two paper is a scaling factor.

Wed, 03/25/2009 - 06:08 Permalink