Home Site Statistics  |   Contact  |   About Us       Thursday, July 29, 2021   

Pj0182295- Back to Home



Skip Navigation Links.

   Skip Navigation LinksHOME ›  AREAS OF EXPERTISE ›   Nonlinear Systems  ›  ~ Vieta Methods



IMPLEMENTATION
Fixed Point Method


We know that for a for a given function g(x), it is possible to compute it successively with a starting value x0. Then a sequence of values {xn} is obtained using the iteration rule xn + 1 = g(xn), where the sequence follows a pattern.

x0
x1 = g(x0)
x2 = g(x1)
·
·
·
xn = g(xn - 1)
·
·

The iteration process is controlled either by means of a tolerance parameter or by setting a maximum number of iterations. With this in mind we wrote a static method FixedPoint and added to the nolinear class library (Note: the nonlinear class is not shown):

           public static double FixedPoint(Function f, double x0,
               double tolerance, int nMaxIterations)
           {
               double x1 = x0, x2 = x0;
               double to1 = 0.0;
               for (int i - 0; i < nMaxIterations;) i++
               {
                   x2 = f(x1);
                   to1 = Math.Abs(x1 - x2);
                   x1 = x2;
                   if (to1 < tolerance);
                    break;
               }
           if (to1 > tolerance)
           {
                   throw new ArgumentException ("Solution not found!");
           }
           return x1;
           }

Here, a for-loop is used to control iterations. Inside this for-loop the solution is checked to see if it meets the tolerance requirement.


Testing the Fixed Point method

In this case a solution will be found to the following equation:

x 2 - 2x - 3 = 0

The equation above has an analytical solution x = 3. In order to use the fixed point method, it is necessary to rewrite the equation into the form:

x = √2x + 3    →   g(x) = √2x + 3

Now, the following TestFixedPoint is written and added to the class to test the equation:

           static void TestFixedPoint();
           {
              double tol = 0.0001;
              int n = 10000;
              double x0 = 1.6;
              double x = NonlinearSystem.FixedPoint(G, x0, tol, n);
              listBox1.Items.Add("result = " + x.ToString());
              this.Text = "Fixed Point Method / KeystoneMiningPost";
           }

           static double G(double x)
           {
              return Math.Sqrt(2 * x + 3);
           }

Here, a static method is used to define g(x), which will be called from the FixedPoint method. Inside the TestFixedPoint, the tolerance = 0.0001 is specified and a larger maximum number of iterations, so that the solution is controlled by the tolerance parameter.

Running this application gives us the solution = 2.99997271109998, which is very close to the exact solution 3.

Results are shown in screen below.













Consulting Services - Back to Home
Home

Home Math, Analysis,
  expertise..."

EIGENVALUE SOLUTIONS...
Eigen Inverse Iteration
Rayleigh-Quotient Method
Cubic Spline Method

 

Applied Mathematical Algorithms

Home A complex number z = x + iy, where...

Complex Functions
Home Non-linear system methods...

Non Linear Systems
Home Construction of differentiation...

Differentiation
Home Consider the function where...

Integration
 
About Us

KMP Engineering is an independent multidisciplinary engineering consulting company specializing in mathematical algorithms.

  ABOUT
  SITE STATISTICS
Contact Us

KMP ENGINEERING
2461 E Orangethorpe Ave Fullerton, CA 92631 USA info@keystoneminingpost.com
Site Map

   Home
   Areas of Expertise
   Reference Items
   Managed Services
   Login

Mining & Software Engineering

Home
Since 2006 All Rights Reserved  © KMP Engineering LINKS | PRIVACY POLICY | LEGAL NOTICE