lunes, 26 de julio de 2010

Applied examples

Problem:

A mining company extracts mineral from two mines, which contains for the mine I 1% nickel and 2% copper, for the mine II nickel 2% and 5% copper. How much mineral must be extracted from each mine to get 4 tons of nickel and nine tons of copper?

Solution:

We want to know the number of tons of mineral must be extracted from each mine, assign literals to those numbers.
Where x are the tons extracted of mine I.
And y are the tons extracted of mine II.
Now we establish algebraic relationships between the literal.

How much nickel is obtained from the mine I?
0.01x
And mine II?
0.02y

To know how many tons must be extracted from each mine must solve the system of two linear equations with two unknowns:

0.01x+0.02y=4
0.02x+0.05y=9


The Matrix




x= (4-0.02y)/0.01
y=(9-0.02x)/0.05


On the first initial value is Y1= 75.

x= (4-0.02(75))/0.01=250
y= (9-0.02(250))/0.05=80


Error:

(80-75)/80*100=6.25%

Iterations are continued as you can see in the diagram and are interpreted as x approaches 200, while the variable y is close to 100 where these results.


the same problem but using gauss seidel relaxation's method.
m = 1.25

x=((4-0.02(75))/0.01)*1.25+(1-1.25)*0=312.5
y= ((9-0.02(312.5))/0.05)*1.25+(1-1.25)*75=50

Error:
for x:
error%= |(312.5-0)/312.5|*100=100%

for y:
error%= |(50-75)/50|*100=50%

The diagram compares the methods.


Excel

gauss-seidel

miércoles, 21 de julio de 2010

Gauss Sediel

Gauss Seidel

The Gauss-Seidel method is a technique for solving the equations of the linear system of equations Ax=b one at a time in sequence, and uses previously computed results as soon as they are available,



There are two important characteristics of the Gauss-Seidel method should be noted. Firstly, the computations appear to be serial. Since each component of the new iterate depends upon all previously computed components, the updates cannot be done simultaneously as in the Jacobi method. Secondly, the new iterate depends upon the order in which the equations are examined. If this ordering is changed, the components of the new iterates (and not just their order) will also change.
In terms of matrices, the definition of the Gauss-Seidel method can be expressed as



where the matrices D,-L , and -U represent the diagonal, strictly lower triangular, and strictly upper triangular parts of A, respectively.
The Gauss-Seidel method is applicable to strictly diagonally dominant, or symmetric positive definite matrices A.

Example:
gauss-sediel

Gauss seidel with relaxation

Example:


Bibliography:
  • Hageman, L. and Young, D. Applied Iterative Methods. New York: Academic Press, 1981.
  • http://mathworld.wolfram.com/Gauss-SeidelMethod.html
  • http://matematicas.unal.edu.co/hmora/mnq.pdf
  • http://www.slideshare.net/freysan/mtodos-iterativos-gauss-seidel-con-relajacin

Inverse matrix

In the development of systems of equations is an effective method using the inverse matrix so that the following is true.
[A][X] = [B]
[X] = [A]-1[B]
[A][A]-1= [I]

[A] -1 is the inverse of the matrix A and [I] is the identity matrix.
The basic calculation is to find the inverse matrix, but must have certain requirements for a matrix to have around:
• Must be a square matrix.
• The determinant must be nonzero.
There are several ways to calculate the inverse of a matrix, but in this case discuss three methods:

Direct method

From:Metodos numericos Grupo O1, Subgrupo 5, UIS

2. Method of gauss-jordan
This method extends the matrix with the identity matrix and gauss-jordan applied.
Example:


From:Metodos numericos Grupo O1, Subgrupo 5, UIS


From:Metodos numericos Grupo O1, Subgrupo 5, UIS

3. Matrix attached
In this process to find the inverse of a matrix using determinants and matrices transposed.
Example:


From:Metodos numericos Grupo O1, Subgrupo 5, UIS

Now you use [X] = [A]-1[B]

Example:

From:Metodos numericos Grupo O1, Subgrupo 5, UIS


Bibliografy:
• Steven Chapra, Métodos numéricos quinta edición.
• http://www.terra.es/personal2/jpb00000/tmatrizinversa.htm
• http://es.wikipedia.org/wiki/Matriz_invertible

Gauss jodan and LU descomposition

Gauss jordan elimination

This is a variation of Gaussian elimination. Gaussian elimination gives us tools to solve large linear systems numerically. It is done by manipulating the given matrix using the elementary row operations to put the matrix into row echelon form. To be in row echelon form, a matrix must conform to the following criteria:

1. If a row does not consist entirely of zeros, then the first non zero number in the row is a 1.

2. If there are any rows entirely made up of zeros, then they are grouped at the bottom of the matrix.

3. In any two successive rows that do not consist entirely of zeros, the leading 1 in the lower row occurs farther to the right that the leading 1 in the higher row.



From this form, the solution is easily(relatively) derived. The variation made in the Gauss-Jordan method is called back substitution. Back substitution consists of taking a row echelon matrix and operating on it in reverse order. Normally the matrix is simplified from top to bottom to achieve row echelon form. When Gauss-Jordan has finished, all that remains in the matrix is a main diagonal of ones and the augmentation, this matrix is now in reduced row echelon form. For a matrix to be in reduced row echelon form, it must be in row echelon form and submit to one added criteria:

• Each column that contains a leading 1 has zeros everywhere else.
Since the matrix is representing the coefficients of the given variables in the system, the augmentation now represents the values of each of those variables. The solution to the system can now be found by inspection and no additional work is required.

Example:

From:http://www.krellinst.org/AiS/textbook/unit2/example_projects/starter/math/matrix/gauss.html




Gauss Jordan


flowchart



LU Decomposition

Definition 1 Let A be an nm matrix. An LU decomposition (sometimes also called an LU factorization) of A , if it exists, is an nn unit lower triangular matrix L and an nm matrix U, in (upper) echelon form, such that
A=LU
The LU factorization is closely related to the row reduction algorithm. In a very real sense, the factorization is a record of the steps taken in row reducing a matrix to echelon form. The matrix L ``encodes'' the sequence of row replacement operations that row reduce the given matrix A to echelon form U .


From:Steven Chapra Metodos Numericos quinta edición

For U, there is a phase similar to that used in the method of Gauss, however, the main diagonal is not converted into one, if not changed by a factor, as follows:


From:Autor's blog

Factor1=a21/a11
And for three Equation
Factor2= a31/a11

The number of factors depends on the number of equations in the system and will be n-1 factors (n number of equations); now to reduce the system to an upper triangular matrix is the following
Equation _2 = -factor1*Equation_1+Equation_2.

So the equation changes completely and two below the pivot will be zero, and Equation 3 will be the same process:

Equation _3 = -factor2*Equation_1+Equation_3.

And
Equation _n = -factor(n-1)*Equation_1+Equation_n.

Where n is the number of equations in the system


From:Autor's Blog

Following the method based on Gauss, now will eliminate the variables below the second pivot, in this case the pivot is a'22 position and will as in the previous steps.
The factor to use is:
Factor_1’= a’32 /a’22


From:Autor's Blog

The process is the same for certain systems of equations.
The factors calculated are those which form the matrix [L], as follows:


From:Autor's Blog

And [U][L]= [A].

For the next step is working with the substitutions, forward and backward.
First calculating a vector [D] by:
[L][D]=[B]
Using forward substitution.
And then I know [D], we calculate [X] that are our variables.
[U][X]=[D]

Example:



Bibliografy
Steven Chapra, Metodos numericos quinta edicion
http://planetmath.org/encyclopedia/LUDecomposition.html
http://www.krellinst.org/AiS/textbook/unit2/example_projects/starter/math/matrix/gauss.html

martes, 20 de julio de 2010

Gauss

It is a method used to solve systems of equations, this two-step

1. Forward elimination of unknowns
2. Back substitution.

The first part aims to reduce the original system of nxn matrix, n unknowns and n equations to upper triangular form.



From:Autor's blog

Now you begin to eliminate the first unknown of the second equation to the last equation, in this case the pivot is the first variable in the first equation.
To do so first multiply the first equation by ( a_21)/a_11 so that a pivot is one, then subtracted from the second equation to make this the first unknown zero, the other unknowns in their coefficients change due to the abduction.


From:Autor's blog



In general the factor will a_n1/a_11 where n indicates the equation that we are. After removal of the unknowns in the first column, we move the second equation but in this case the pivot is the second unknown and repeats the steps above to make this one of the original matrix upper triangular form.


From:Autor's blog


Already in the upper triangular form we move to the next part of the method is the back substitution.
In the equation n unknown we would only equal to the answer’s vector, so using the following formula Xn= b_n/a_nn get the latest variable, and I know this can go back in the matrix and calculate all the variables.


Digrama de flujo


From:Metodos numericos Grupo O1, Sudgrupo 2, UIS

A video demostration


Bibliografy
  • Steven Chapra, Metodos numericos quinta edicion.
  • http://www.slideshare.net/nestorbalcazar/mtodos-numricos-05

Solving systems of small equations

To solve small systems where the number of unknowns and equations is less than or equal to 3 without the need for a computer.


There are three different ways:
1. Graphic method.
2. Cramer's rule.
3. Elimination of unknowns


Graphic method.
This method is to plot the equations become the equations leaving a variable in function of another variable. Is important clear the same variable in both equations.


From: Autor's blog

By plotting the equations on the same plane, the intersection of those lines are the values of the variables.

Example:
x-3y=1
x+4y=8




From:Métodos Numéricos Grupo O1, subgrupo 1, UIS


There is one drawback with respect to the graphical method and it happens when the system is composed of more than three equations, since for three-dimensional graphics would make the cut and where the three lines would be the solution but for more than three the method does not work, this reason loses importance and is limited to solve larger systems.

Although the method gives information on how they behave systems, for example in the following graphs analyze what happens.


From:Métodos Numéricos Grupo O1, subgrupo 1, UIS

In this case happen to be parallel lines and therefore have no solution.


From:Métodos Numéricos Grupo O1, subgrupo 1, UIS

In this case the lines intersect at all points at which the system will have infinitely many solutions.


From:Métodos Numéricos Grupo O1, subgrupo 1, UIS

This special case is called ill-conditioned systems and to the point where the lines intersect is not very clear and can cause problems when developing the system.

Cramer's rule

This rule tells us that each value of the unknowns can be expressed as the division of the determinant of the matrix modified origin, where the vector of responses b is replaced by the position of the unknown to find the array origin, between the determinant of the initial matrix, as follows:



From:Autor's blog

Example:



Second Part.



Elimination of unknowns
In the method for elimination, as its name says, we must remove one of the unknowns, are these, for example: x, y, z, this is achieved by multiplying one of the equations by a number either positive or negative where all components of the equation are affected by this number, and since the sum by the other equation with the unknown excess selected will be deleted.


After eliminated the unknown, the system reduces to a single unknown (if it is a 2X2), which clears and you get the value of the variable. Since this value is to replace the variable in one of the original equations and solve for the missing variable.

Example:


From:Autor's blog

This method can be developed for larger systems but the difficulty and the tedious calculations do unpopular.


Bibliografy:
  • Esteven Chapra, Metodos numericos para ingenieros, Quinta Edicion.
  • Analisis numerico escrito por richard l. Burden.+
  • http://www.mitecnologico.com/Main/SolucionMetodoDeEliminacion

Matrices

Matrices and determinants are algebraic tools used in many areas such as social science, economic and biological weapons, with which it facilitates the management, data manipulation and characterization.




One way to represent matrices by square brackets is as follows:


From: Author's blog




Types of matrices


Symmetric matrix: square matrix where the values of ai,j=aj,i


from:Author's blog

Square Matrix: this matrix where the number of rows is equal to the number of columns.


from:Author's blog


Transpose of a matrix:
The transpose of a m by n matrix is defined to be a n by m matrix that results from interchanging the rows and columns of the matrix. The transpose of a matrix is designated by the superscript T or " ' ". The matrix A and the transpose of a matrix A are as follows.


from:Author's blog

Triangular matrix:
There are two types of triangular matrices: upper triangular matrix and lower triangular matrix. Triangular matrices have the same number of rows as they have columns; that is, they have n rows and n columns. A matrix U is an upper triangular matrix if its nonzero elements are found only in the upper triangle of the matrix, including the main diagonal; that is:
uij = 0 if i > j
A matrix L is an lower triangular matrix if its nonzero elements are found only in the lower triangle of the matrix, including the main diagonal; that is:
lij = 0 if i <>


from:http://publib.boulder.ibm.com/infocenter/clresctr/vxrx/index.jsp?topic=/com.ibm.cluster.essl43.guideref.doc/am501_trimat.html

Augmented matrix:
This matrix is obtained by combining two matrices, as follows:


from:Author's blog

Band matrix:
Is a matrix with non-zero values are confined in an environment of the main diagonal, forming a band of non-zero values which complement the main diagonal of the matrix and more diagonal in each of its sides.



from:Author's blog

Matrix multiplication:
In matrix multiplication should be noted that the number of columns of a matrix is equal to the number of rows from the other parent to multiply, as:
Am*n * Bn*d
is denoted
AB = Cm*d





from:Author's blog

Determinant
The determinant is an algebraic operation that transforms a square matrix M into a scalar. This operation has many useful and important properties. For example, the determinant is zero if and only the matrix M is singular (no inverse exists).


Let M be an n n matrix with entries Mij that are elements of a given field. The determinant of M , or detM for short, is the scalar quantity.



from:Autor's blog

Bibliografy:
• http://personal.redestb.es/ztt/tem/t6_matrices.htm
• http://portales.educared.net/wikiEducared/index.php?title=M%C3%A9todo_de_reducci%C3%B3n_de_Gauss
• http://planetmath.org/encyclopedia/Determinant2.html

jueves, 15 de julio de 2010

Review

A little review:
Ra%EDces