math15 program project

Upload: ivan-perez

Post on 14-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 MATH15 Program Project

    1/13

    IvanPerez

    [Type the company name]

  • 7/29/2019 MATH15 Program Project

    2/13

  • 7/29/2019 MATH15 Program Project

    3/13

    [MATH15/B4 PROJECT] [Pick the date]

    As before, we use the symbol to indicate that the matrix preceding the arrow is being

    changed due to the specified operation; the matrix following the arrow displays the result ofthat change.

    2. Use elementary row operations on the augmentedmatrix [A|b] to transform A into diagonal form.

    At this point we have a diagonal coefficient matrix. The final step in Gauss-Jordan Elimination

    is to make each diagonal element equal to one. To do this, we divide each row of the

    augmented matrix by the diagonal element in that row.

    3. By dividing the diagonal element and the right-hand-side element in each row by the diagonal element in thatrow, make each diagonal element equal to one.

  • 7/29/2019 MATH15 Program Project

    4/13

    [MATH15/B4 PROJECT] [Pick the date]

    Hence,

    When performing calculations by hand, many individuals choose Gauss-Jordan Elimination

    over Gaussian Elimination because it avoids the need for back substitution. So we have made

    a program that is able to perform Gauss-Jordan Elimination in seconds. Heres how it works:

    Open MATH15 Gauss-Jordan.htm using any web browser (Google Chrome,Mozilla Firefox, or Safari) or any application that supports .htm files.The program will open along with a prompt that asks you a datum that will be

    needed to execute the program.

    Enter the desired number ofequations. Then press OK.Enter the desired number ofcolumns. Then press OK.Enter the elements of the first equation as decimals separated by a space,thenpress OK. (Example: 2x - 3y = -4 would be 2 -3 -4 then OK.)Repeat Step 5 for the other proceeding equations.The program will show a solution making the system of equations to be in

    reduced-row echelon form.

  • 7/29/2019 MATH15 Program Project

    5/13

    [MATH15/B4 PROJECT] [Pick the date]

    Gauss-Jordan Matrix Solutions Using JavaScript

  • 7/29/2019 MATH15 Program Project

    6/13

    [MATH15/B4 PROJECT] [Pick the date]

    //Function to define array elements;

    function defineelements(){

    lengthofequation=equation[i].length;

    builder="";

    count=0;for(count==0;count

  • 7/29/2019 MATH15 Program Project

    7/13

    [MATH15/B4 PROJECT] [Pick the date]

    //*** Function printsolution

    function printsolution(){

    i=1;j=1

    for(i=1;i

  • 7/29/2019 MATH15 Program Project

    8/13

    [MATH15/B4 PROJECT] [Pick the date]

    //*******

    //Main Body

    //*******

    //**********************************************************************

    numberofequations=prompt("How many equations are there for this system?","");numberofrows=numberofequations;

    numberofcolumns=prompt("How many columns are there?","");

    equation=new Array(numberofcolumns+1);

    k=0;

    //Set all elements to 0.;

    for(k==0;k

  • 7/29/2019 MATH15 Program Project

    9/13

    [MATH15/B4 PROJECT] [Pick the date]

    //************************************************************************

    //Call functions

    //***

    i=1;

    j=1;for(i==1;i

  • 7/29/2019 MATH15 Program Project

    10/13

    [MATH15/B4 PROJECT] [Pick the date]

    multiplier=a[rowabove][columntozero];

    rowtozero=rowabove;//Above the row with a one.

    multiplyaddtorow();

    };//End of 'for'

    };//End of 'if'printsolution();

    };//End of row reduced Echelon form

    //-->

  • 7/29/2019 MATH15 Program Project

    11/13

    [MATH15/B4 PROJECT] [Pick the date]

  • 7/29/2019 MATH15 Program Project

    12/13

    [MATH15/B4 PROJECT] [Pick the date]

  • 7/29/2019 MATH15 Program Project

    13/13

    [MATH15/B4 PROJECT] [Pick the date]