Back to index

wims  3.65+svn20090927
Static Public Member Functions
rene.zirkel.expression.Secant Class Reference

List of all members.

Static Public Member Functions

static double compute (FunctionObject F, double a, double b, double eps) throws ConstructionException

Detailed Description

Definition at line 10 of file Secant.java.


Member Function Documentation

static double rene.zirkel.expression.Secant.compute ( FunctionObject  F,
double  a,
double  b,
double  eps 
) throws ConstructionException [inline, static]

Definition at line 11 of file Secant.java.

{      public static double compute (FunctionObject F,
              double a, double b, double eps)
       throws ConstructionException
       {      double ay=F.evaluateF(a),by=F.evaluateF(b);
              double c=(a+b)/2;
              if (ay*by>eps)
                     throw new ConstructionException("");
              while (Math.abs(b-a)>eps)
              {      double cy=F.evaluateF(c);
                     if (Math.abs(cy)<eps) return c;
                     if (cy*ay>0)
                     {      if (Math.abs(ay-cy)<eps)
                            {      a=c; ay=cy; c=(a+b)/2;
                            }
                            else
                            {      double d=a-ay*(a-c)/(ay-cy);
                                   if (d>b || d<a)
                                   {      a=c; ay=cy; c=(a+b)/2;
                                   }
                                   else
                                   {      a=c; ay=cy; c=d;
                                   }
                            }
                     }
                     else
                     {      double d=a-ay*(a-c)/(ay-cy);
                            b=c; by=cy; c=d;
                     }
              }
              return c;
       }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: