Home Login  |   Contact  |   About Us       Thursday, November 28, 2024   

j0182018 - Back to Home
   Skip Navigation LinksHOME ›  AREAS OF EXPERTISE  #2 ›   Nonlinear Systems  ›  ~ Vieta Methods



Skip Navigation Links.




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.













   Quotes

Consulting Services - Back to Home


Home

Home Math, Analysis,
  expertise..."

EIGENVALUE
SOLUTIONS...


> Rayleigh-Quotient Method

> Cubic Spline Method

 

Applied Mathematical Algorithms

Home

ComplexFunctions

Home

NonLinear
Home

Differentiation
Home

Integration
About Us


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

      (About Us) →
Areas of
Expertise


SpecialFunctions
VectorsMatrices
OptimizationMethods
ComplexNumbers
Interpolation
CurveFitting
NonLinearSystems
LinearEquations
DistributionFunctions
NumericalDifferentiation
NumericalIntegration
DifferentialEquations
Smalltalk
FiniteBoundary
Eigenvalue
Graphics
Understanding
Mining


MiningMastery
MineralNews
MineralCommodities
MineralForum
Crystallography
Services


NumericalModeling
WebServices
MainframeServices
OutsourceServices

LINKED IN
MINE REVIEW(by G.Pacheco)
Brand





Home

Login

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