Thursday, 2024-12-12, 5:44 AM

Main Sign Up Login
Welcome, Guest · RSS
Site menu
Search
Site friends
  • acmgmat
  • nano-unt
  • fc-unt
  • accf
  • Statistics

    Total online: 3
    Guests: 3
    Users: 0
     Publisher
    Main » Articles » E-Learn » Numerical Methods

    Regula Falsi Method - Wolfram Mathematica v10.

    ROOTFINDING

     

     Regula Falsi Method

    www.jesus-avalos.ucoz.com

     

    ALGORITHM CODE:

     RegulaFalsi[a0_,b0_,m_]:=Module[{},a=N[a0];b=N[b0]; c=(a*f[b]-b*f[a])/(f[b]-f[a]);k=0;

      output={{k,a,c,b,f[c]}};

      While[k<m, If[Sign[f[b]]==Sign[f[c]],b=c, a=c;];

       c=(a*f[b]-b*f[a])/(f[b]-f[a]);

       k=k+1;

       output=Append[output,{k,a,c,b,f[c]}];];

      Print[NumberForm[TableForm[output,TableHeadings->{None,{"k","ak","ck","bk","f[ck]"}}],16]];

      Print[" c=",NumberForm[c,16]];

      Print[" f[c]=",NumberForm[f[c],16]];]

     

    EXAMPLE:

     

     

     f[x_]=x^3-2x^2+3x/2

     (3 x)/2-2 x2+x3

     

     

     

     RegulaFalsi[-1,1,12]

     {

     {k, ak, ck, bk, f[ck]},

     {0, -1., 0.8, 1., 0.432},

     {1, -1., 0.6423357664233577, 0.8, 0.4033378536513656},

     {2, -1., 0.5072408162536918, 0.6423357664233577, 0.3767843689852098},

     {3, -1., 0.3907901518625014, 0.5072408162536918, 0.340431619474261},

     {4, -1., 0.2929747128750934, 0.3907901518625014, 0.2929409494830454},

     {5, -1., 0.2139490699474353, 0.2929747128750934, 0.2391685443454786},

     {6, -1., 0.1526854897957456, 0.2139490699474353, 0.1859620523688113},

     {7, -1., 0.1069412526417537, 0.1526854897957456, 0.1387620422415913},

     {8, -1., 0.07382866194205702, 0.1069412526417537, 0.1002440660353247},

     {9, -1., 0.0504288271173981, 0.07382866194205702, 0.07068535133336745},

     {10, -1., 0.03418401370580981, 0.0504288271173981, 0.04897887259222585},

     {11, -1., 0.02304895054924056, 0.03418401370580981, 0.03352316243099189},

     {12, -1., 0.0154840093511178, 0.02304895054924056, 0.02275021729713151}

    }

      c= 0.0154840093511178

      f[c]= 0.02275021729713151

     

    Concise Program for the Regula Falsi

     RegulaFalsi2[a0_,b0_,m_]:=Module[{},a=N[a0];b=N[b0];Ya=f[a];Yb=f[b];

      c=(a*Yb-b*Ya)/(Yb-Ya); Yc=f[c]; k=0;While[k<m,

       If[Sign[Yb]==Sign[Yc],

        b=c;

        Yb=Yc,

        a=c;

        Ya=Yc;];

       c=(a*Yb-b*Ya)/(Yb-Ya);

       Yc=f[c];

       k=k+1;];

      Print[" c=", NumberForm[c,11]];

      Print["f[c]=", NumberForm[Yc,11]];]

     

     EXAMPLE:

     f[x_]=x^3-2x^2+3x/2

     (3 x)/2-2 x2+x3

     RegulaFalsi2[-1,1,12]

      c= 0.015484009351

     f[c]= 0.022750217297

     

     

     Plot[(3 x)/2-2 x2+x3,{x,-1.,1.}]

     

    Category: Numerical Methods | Added by: JARMASTER (2015-08-05)
    Views: 2656 | Tags: Wolfram Mathematica, método de la falsa posición, Regula falsi method
    SOFT JAR © 2024
    Create a free website with uCoz