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

jueves, 6 de mayo de 2010

Mathematical modeling

Mathematical modeling

A mathematical model is a representation of a phenomenon in the real world, using mathematical concepts to describe it. This is built for the purpose of questioning in relation to one aspect of the real world.
The formulation of a mathematical model involves:

• Identification of factors (variables) that is specific to the system.
• Establish reasonable assumptions about the system.


In the formulation of hypotheses involving variables change, a reason which they are involved, thus variables that are altered due to other, that is to say, derivatives or differential equations.



CHARACTERISTICS OF A MODEL:
• Diagrams or sketches are for the most part, they represent reality.
• Its main objective is to explain and predict issues of a situation.


NUMERIACAL APPROXIMATION
An approximation is an inexact representation of something that is still close enough to be useful. Although approximation is most often applied to numbers, it is also frequently applied to such things as mathematical functions, shapes, and physical laws.

ERROR
In science and engineering in general an error is defined as a difference between the desired and actual performance or behavior of a system or object.

ERROR ROUNDING
The rounding error is the loss of mathematical precision that occurs when rounded to the decimal part of a number. It's the difference between the value of the original number and value of the number after you apply the rounding.



ERROS TRUNCATION

Truncation errors are related to the method of approach to be used because they generally face an infinite series of terms, will tend to cut the number of terms, introducing an error at that time, not to use the complete series.



SIGNIFICANT FIGURES

The significant figures of a number are those digits that carry meaning contributing to its precision.


TOTAL NUMBER ERROR
The total numerical error is defined as the sum of the rounding and truncation errors introduced in the calculation.

Bibliography
Javier Aracil Santonja 1986 editorial TECNOS S.A 1986 o’Donnel 27-Madrid -9.
http://www2.uca.es/matematicas/Docencia/2005-2006/FC/0206024/Apuntes/tema1_0506.pdf
http://html.rincondelvago.com/metodos-numericos_5.html
http://www.slideshare.net/nestorbalcazar/mtodos-numricos-03
http://idkernel.sytes.net/MetNum/pdfs/raices2.pdf
http://noosfera.indivia.net/metodos/secante.html
http://es.wikipedia.org/wiki/M%C3%A9todo_de_la_secante
http://www.itescam.edu.mx/principal/sylabus/fpdb/recursos/r45622.PDF

Graphical method

Closed methods

A simple method to obtain an approximation to the root of the equation F (x) = 0; is graph and see where it cuts the x-axis.

Example: Y = x^2 – 3;

using a software:
X1≈ 1.732
X2 ≈ -1.732

The bisection method

If f(x) is real and continuous in the range from xi to xf f(xf) have opposite signs, then there is at least one real root between intervals.
The bisection method is a type of incremental search in which the interval is always divided in half. If the value of the function changes sign on an interval, we evaluate the value of the function at the midpoint.

Root position is determined at the point half the subinterval in which a sign change occurs.
This process is repeated to achieve the best approximation.
The false position method

An alternative technique bisection method is a straight line joining f (xi) and f (xf).
The intersection of this line with the x-axis represents a better approximation to the root; the fact that the curve is replaced by a straight line gives a false position of the root.



From http://www.slideshare.net/nestorbalcazar/mtodos-numricos-03



From http://www.slideshare.net/nestorbalcazar/mtodos-numricos-03

Open methods

Open methods

Open methods are based on formulas that require a single initial value (fixed point or Newton Raphson) or starting with a couple of them (secante), not necessarily surround the root.

Fixed point

Open methods use a formula to predict the root. This formula can be developed as a simple fixed point iteration, to rearrange the equation f (x) = 0 so that x is the left side of the
equation.
Newton-Raphson’s Method

Perhaps, in the formulas to find roots, the Newton-Raphson formula is the most widely used. If the initial value of the root is then xi can extend a tangent from the point [x, f (x)] of the curve. The point where this tangent crosses the x-axis represents a better approximation of the root.


From http://www.slideshare.net/nestorbalcazar/mtodos-numricos-03


Example:
Secant’s method

This method is a modification of the Newton-Raphson’s method; since this is not necessary to calculate the derivative then you have the following expression.

f^' (x)=(f(x_(i-1) )-f(x_i))/(x_(i-1)-x_i ) (1)

Newton raphson

x_(i+1)= x_i-(f(x_i))/(f^' (x_i)) (2)

(1) in (2) Secante

x_(i+1)≈x_i-(f(x_i)(x_(i-1)-x_i ))/(f(x_(i-1))-f(x_i))

This expression is replaced in the Newton-Raphson’s equation and gives us the formula is called the secant method, and this is to approximate the slope of the straight line connecting the function evaluated at the point of study and at the point the previous iteration.

Example:
Muller’s method

This is a method for finding roots of polynomial equations of the general form:

Where n is the order of the polynomial and are constant coefficients. Continuing with the polynomials, they comply with the following rules:
•For equation of order n, there are n real or complex roots. It should be noted that these roots aren’t necessarily distinct.
•If n is odd, there is at least one real root
•If the roots are complex, there is a conjugate pair.

With the secant method by drawing a straight line crossing the three-point function,
In the muller’s method these points crossing the function but approximating to a parabola, then find the point which cuts the x-axis.

Bairstow’s method

Bairstow's method is an efficient algorithm for finding the roots of a polynomial of arbitrary degree. This method is more efficient as the others methods because it finds real and imaginary roots.
The method estimated the roots, using quadratic factors like:
x^(2 )- hx-d

Where the polynomial
p(x)=(x^2-hx-d) p_1 (x)

If x^(2 )- hx-d is not quadratic polynomial factor this would be expressed as follows:
p(x)=(x^2-hx-d) p_1 (x)+Ax+B

Where A and B are function of h and d’s, then looking for values of h and d where A and B are iqual to cero.
The use the newton-raphson`s method.