Sei sulla pagina 1di 15

UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA

FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL


ESCUELA : INGENIERÍA CIVIL -1-
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

Apuntes de Métodos Numéricos Aplicados


PRIMERA PRÁCTICA: APROXIMACIÓN DEL NÚMERO PI (π)

1. INTRODUCCIÓN:

Letra griega pi. Símbolo adoptado inicialmente en 1706 por William Jones y
popularizado por Euler.

π (pi) es una constante matemática cuyo valor es igual a la proporción existente


entre el perímetro de la circunferencia y la longitud de su diámetro, se emplea
frecuentemente en matemática, física e ingeniería. El valor numérico de π truncado
a sus diez primeras posiciones decimales, es el siguiente:

La notación con la letra griega π proviene de la inicial de las palabras de origen


griego "περιφέρεια" (periferia) y "περίµετρον" (perímetro) de una circunferencia.
Esta notación fue usada por primera vez en 1706 por el matemático galés William
Jones y popularizada por el matemático Leonhard Euler en su obra "Introducción al
cálculo infinitesimal" de 1748. Fue conocida anteriormente como constante de
Ludoph (en honor al matemático Ludolph van Ceulen) o como constante de
Arquímedes (No se debe confundir con el número de Arquímedes). El valor
computado de esta constante ha sido conocido con diferentes precisiones a lo largo
de la historia, de esta forma en una de las referencias documentadas más antiguas
como la Biblia aparece de forma indirecta asociada con el número natural 3 y en
Mesopotamia los matemáticos la empleaban como 3 y una fracción añadida de 1/8.
π es una de las constantes matemáticas que más aparece en las ecuaciones de la
física, junto con el número e, y es, tal vez por ello la constante que más pasiones
desata entre los matemáticos profesionales y amateur.

a. Las primeras 100 cifras decimales.-


• A pesar de tratarse de un número irracional π se continúa investigando con la
intención de averiguar la máxima cantidad posible de cifras tras la coma. Las
100 primeras cifras del número pi tras la coma son:
π ≈ 3,141 592 653 589 793 238 462 643 383 279 502 884 197 169 399 375
105 820 974 944 592 307 816 406 286 208 998 628 034 825 342 117 067 9

• La verdad es que en ciencia y en ingeniería esta constante puede emplearse la


mayoría de las veces con una precisión simple de una docena de decimales,
con 50 decimales se podría describir con precisión la curvatura del Universo
con error más pequeño que el tamaño de un protón

b. El renacimiento y el número pi.-


• A partir del siglo XII con el empleo de cifras arábigas en los cálculos se facilitó
mucho la posibilidad de obtener mejores cálculos para π. El matemático
Leonardo Pisano, en su “Practica Geometriae” amplifica el método de
Arquímedes proporcionando un intervalo más estrecho. Algunos matemáticos
en el siglo XVII como Vieta usaron polígonos de hasta 393.216 lados para
aproximarse con buena precisión a 3'141592653.

• Algunas aproximaciones históricas de π anteriores a la época computacional


pueden verse en la siguiente tabla:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL -2-
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

Error
Año Matemático o documento Aproximación
(en partes por millón)

~1650 adC Papiro de Ahmes (Egipto) 28/34 ~ 3,1605 6016 ppm

~1600 adC Tablilla de Susa (Babilonia) 3 1/8 = 3,125 5282 ppm

~950 adC La Biblia (Reyes I, 7,23) 3 45070 ppm

~500 adC Bandhayana (India) 3,09 16422 ppm

entre 3 10/71 y 3 1/7 <402 ppm


~250 adC Arquímedes de Siracusa
empleó 211875/67441 ~ 3,14163 13,45 ppm

~200 Claudio Ptolomeo 377/120 = 3,141666... 23,56 ppm

263 Liu Hui (China) 3,1416 2,34 ppm

263 Wang Fan 157/50 = 3,14 507 ppm

~300 Chang Hong (China) 101/2 ~ 3,1623 6584 ppm

entre 3,1415926 y 3,1415929 <0,078 ppm


~500 Zu Chongzhi (China)
empleó 355/113 ~ 3,1415929 0,085 ppm

~500 Aryabhata 3,1416 2,34 ppm

~600 Brahmagupta 101/2 ~ 3,1623 6584 ppm

~800 al-Jwarizmi 3,1416 2,34 ppm

1220 Fibonacci 3,141818 72,73 ppm

1400 Madhava 3,14159265359

1424 Al-Kashi 2π = 6.2831853071795865 0,1 ppm

• El matemático inglés John Wallis desarrolló en 1655 la conocida serie Producto


de Wallis:

• De la misma forma Leibniz calculó de una forma más complicada en 1682 la


siguiente serie que lleva su nombre:

2. BUSCANDO UNA APROXIMACIÓN RACIONAL PARA PI.-

• En 1665, el inglés John Wallis descubre el producto infinito


π /2 = 2/1 * 2/3 * 4/3 * 4/5 * 6/5 * ...,
pero desafortunadamente su convergencia es muy lenta.
• En 1674 el alemán G. Leibnitz da la serie:

--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL -3-
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

π /4 = 1 - 1/3 + 1/5 -1/7 + 1/9 - ...

Pero presenta el mismo problema. Tienen que sumarse unos 19 millones de


términos para conseguir 7 decimales correctos. Dejemos claro que el haber
encontrado estas expresiones supone un gran mérito, aunque no son útiles en
la práctica para calcular π con precisión. La serie de Leibnitz puede deducirse
fácilmente del desarrollo de la función arcotangente como serie de potencias,
encontrado por el inglés Gregory (1671):

Que para x = 1 nos da la serie anterior. Es fácil darse cuenta de que si


tomamos para x un valor comprendido entre 0 y 1, entonces los términos de la
serie se hacen pequeños de forma más rápida, y tenemos que sumar muchos
menos términos para conseguir una buena aproximación. Proponemos por
ejemplo tomar x = raíz(3)/3, y obtenemos la serie:

π /6 = raíz(3)/3 * ( 1 - 1/(3*3) + 1/(5*32) - 1/(7*33) + 1/(9*34) - ... )

que converge de forma bastante rápida. Sólo con sumar 10 términos y


multiplicar por 2*raíz(3), tengo un valor de π con 5 decimales correctos. Sin
embargo esta serie no fue utilizada en la práctica, ¿por qué?. Porque había que
calcular la raíz de 3 con muchos decimales exactos para obtener una buena
aproximación, y esto no era una tarea fácil a finales del siglo XVII.

• La solución a todo debía ser una serie de convergencia rápida y que no


implicara el cálculo de raíces o expresiones excesivamente complejas. John
Machin (1706) encuentra la solución:

π /4 = 4*arc tan (1/5) - arc tan (1/239)

Téngase en cuenta que tan (4*arc tan (1/5)) = (5/6) / (119/144) = 120/119,
utilizando dos veces la fórmula de la tangente del ángulo doble.

Por tanto, tan (4*arc tan (1/5) - arc tan (1/239) = [tan (4*arc tan (1/5)) -
1/239] / [1 + tan (4*arc tan (1/5))*1/239]; y sustituyendo el primer valor
obtenido nos queda (120/119 - 1/239) / (1 - 120/119 * 1/239) = (28680 -
119) / (28441+120) = 1.

En la práctica el número de términos que hace falta sumar correspondientes al


desarrollo de arc tan (1/239) se limita a unos pocos sumandos, pues éstos se
hacen muy pequeños rápidamente. En el desarrollo del otro término hay que
tomar más sumandos, pero el cálculo de estos es mucho más sencillo.
Utilizando su fórmula, Machin consiguió 100 decimales (calculados a mano,
estamos a principios del siglo XVIII).

• Años más tarde, Euler encontró algunas fórmulas más de las que destacamos
dos por su sencillez y belleza. En 1734 consigue calcular la suma de los
inversos de los cuadrados, problema que se había resistido durante años a los
intentos de muchos matemáticos. La convergencia de esta serie es, sin
embargo, lenta,

∑1/n2 = 2
/6

La segunda, descubierta en 1738, converge de una forma mucho más rápida.

arc tan (1) = arc tan (1/2) + arc tan (1/3) = π /4

--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL -4-
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

• Análisis matemático:

(Fórmula de Leibniz)

(Producto Wallis)

(Fórmula Euler)

(Identidad de Euler)

(Fórmula de la campana de Gauss)

(Fórmula de Stirling)

(Euler)

(Euler)

• Además, π tiene varias representaciones como fracciones continuas:

• Un número racional muy acercado a PI es:

Una de las referencias documentadas más antiguas al número pi se puede encontrar en un versículo poco
conocido de la Biblia:'Hizo una fuente de metal fundido que medía 10 codos de diámetro: era completamente
redonda, y su altura era de 5 codos y una línea de 30 codos lo rodeaba'. — (I Reyes 7, 23)
Se puede ver como una idea similar se puede encontrar en II Crónicas 4, 2. En él aparece en una lista de
requerimientos para la construcción del Gran Templo de Salomón, construido sobre el 950 adC y su interés aquí
radica en que da un valor de π = 3.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL -5-
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

3. SOBRE EL NÚMERO PI

Pi es la razón de la circunferencia de un círculo a su diámetro. En distintas culturas,


china, egipcia, europea, india, etc., se trato de obtener mejores aproximaciones de
Pi por ser de aplicación en campos tan distintos como la astronomía o la
construcción. A continuación os exponemos algunas, que no todas de las
curiosidades sobre este peculiar número.

• Muchos de los intentos de evaluar Pi en la antigüedad utilizaban el método de calcular el perímetro


de polígonos inscritos y circunscritos a circunferencias.

• Modernamente para evaluar Pi se utiliza una serie infinita convergente. Este método fue utilizado por
primera vez en Kerala (India) en el Siglo XV

• En 1706, el inglés William Jones fue el primero en utilizar el símbolo griego para denotar la
relación entre la circunferencia y su diámetro. Euler en su obra "Introducción al cálculo infinitesimal",
publicada en 1748, le dio el espaldarazo definitivo.

• Muchos intentos para determinar Pi con exactitud están relacionados con el clásico problema de la
cuadratura del círculo : "construir, utilizando únicamente regla y compás, un cuadrado de área igual
a un círculo dado".

• Johan Heinrich Lambert(1728-1777), matemático alemán, probó que Pi es irracional. ( Un número


irracional no se puede escribir en forma de fracción racional. Números racionales son : 1, 2 , 3/4,
17/23)

• El matemático alemán Ludolph van Ceulen(1540-1610) pidió que, como epitafio, escribiesen en su
lápida las 35 cifras del número Pi que había calculado. Los alemanes llaman a Pi el número ludofiano.

• William Shanks, matemático inglés, dedico 20 años de su vida a la obtención de 707 decimales de
Pi.(En 1945 se descubrió que había cometido un error en el decimal 528 y a partir de este todos los
demás eran incorrectos)

• En 1949 uno de los primeros ordenadores el ENIAC, trabajando durante 70 horas, determino Pi con
2037 decimales.

• En 1959, ordenadores en Francia e Inglaterra calcularon más de 10.000 cifras de Pi.

• En 1961 Daniell Shanks(sin relación con William Shanks) y Wrench, obtuvieron en 8 h 23 min,
100.265 cifras en un IBM 7090.

• En 1983, Yoshiaki Tamura y Yasumasa Kanada, en menos de 30 h, en un HITAC M-280 H obtuvieron


16.777.206 (224) cifras.

• En Julio de 1997, Yasumasa Kanada y Daisuke Takahashi obtuvieron 51.539.600.000 cifras,


utilizando un HITACHI SR2201 con 1024 procesadores.

• Ferdinand Lindemann(1852-1939) demostró que Pi es un número trascendental. Esto significa entre


otras cosas que el problema de la cuadratura del círculo no tiene solución. Pese a ello todavía se
sigue intentando.

• Desde la primera computadora ya se empezó a desarrollar programas para el cálculo del número pi
con el mayor número de cifras posibles, de esta forma un ENIAC en 1949 fue capaz de romper todos
los records actuales con 2037 lugares decimales (en 70 horas), poco a poco se fueron sucediendo los
ordenadores que batían records y de esta forma pocos años después (1954) un NORAC llega a 3092
cifras, durante casi una década de los años 1960 los IBM fueron batiendo records hasta que un IBM
7030 pudo llegar en 1966 a 250000 cifras decimales (8 h 23 min). Durante esta época se probaban
los nuevos ordenadores con algoritmos para la generación de series de números procedentes de π

• Ya en la década de 2000 los ordenadores son capaces de sacar cifras record inmensamente grandes
como en 2004 en el que fueron capaces de sacar 1,3511 billones de lugares decimales mediante el
uso de un supercomputador Hitachi que llegó a trabajar sólo 500 horas para realizar el cálculo.

• En la época computacional del cálculo de pi las cifras se dispararon no sólo debido a la potencia de
cálculo que estas máquinas eran capaces de generar, sino que también era un prestigio y un reto
para el constructor de la máquina que apareciera su marca en la lista de los records.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL -6-
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

Año Descubridor Ordenador utilizado Número de cifras decimales

1949 G.W. Reitwiesner y otros ENIAC 2.037

1955 MORC 3.089

1959 Guilloud IBM 704 16.167

1967 CDC 6600 500.000

1973 Guillord y Bouyer CDC 7600 1.001.250

1981 Miyoshi y Kanada FACOM M-200 2.000.036

1982 Guilloud 2.000.050

1986 Bailey CRAY-2 29.360.111

1986 Kanada y Tamura HITAC S-810/20 67.108.839

1987 Kanada, Tamura, Kobo y otros NEC SX-2 134.217.700

1988 Kanada y Tamura Hitachi S-820 201.326.000

1989 Hermanos Chudnovsky CRAY-2 y IBM-3090/VF 480.000.000

1989 Hermanos Chudnovsky IBM 3090 1.011.196.691

1991 Hermanos Chudnovsky 2.260.000.000

1994 Hermanos Chudnovsky 4.044.000.000

1995 Kanada y Takahashi [2] HITAC S-3800/480 6.442.450.000

1997 Kanada y Takahashi [3] Hitachi SR2201 51.539.600.000

1999 Kanada y Takahashi [4] Hitachi SR8000 68.719.470.000

1999 Kanada y Takahashi [5] Hitachi SR8000 206.158.430.000

2002 Kanada y otros [6] Hitachi SR8000/MP 1.241.100.000.000

PI=3’...

1415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899


8628034825 3421170679 8214808651 3282306647 0938446095 5058223172 5359408128 4811174502
8410270193 8521105559 6446229489 5493038196 4428810975 6659334461 2847564823 3786783165
2712019091 4564856692 3460348610 4543266482 1339360726 0249141273 7245870066 0631558817
4881520920 9628292540 9171536436 7892590360 0113305305 4882046652 1384146951 9415116094
3305727036 5759591953 0921861173 8193261179 3105118548 0744623799 6274956735 1885752724
8912279381 8301194912 9833673362 4406566430 8602139494 6395224737 1907021798 6094370277
0539217176 2931767523 8467481846 7669405132 0005681271 4526356082 7785771342 7577896091
7363717872 1468440901 2249534301 4654958537 1050792279 6892589235 4201995611 2129021960
8640344181 5981362977 4771309960 5187072113 4999999837 2978049951 0597317328 1609631859
5024459455 3469083026 4252230825 3344685035 2619311881 7101000313 7838752886 5875332083
8142061717 7669147303 5982534904 2875546873 1159562863 8823537875 9375195778 1857780532
1712268066 1300192787 6611195909 2164201989 3809525720 1065485863 2788659361 5338182796
8230301952 0353018529 6899577362 2599413891 2497217752 8347913151 5574857242 4541506959
5082953311 6861727855 8890750983 8175463746 4939319255 0604009277 0167113900 9848824012
8583616035 6370766010 4710181942 9555961989 4676783744 9448255379 7747268471 0404753464
6208046684 2590694912 9331367702 8989152104 7521620569 6602405803 8150193511 2533824300
3558764024 7496473263 9141992726 0426992279 6782354781 6360093417 2164121992 4586315030
2861829745 5570674983 8505494588 5869269956 9092721079 7509302955
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL -7-
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

ALGORITMO DE BORWEIN:

Es un algoritmo desarrollado por Jonathan y Peter Borwein que permite el cálculo de 1/π.
Se procede de la siguiente forma:

• Se comienza con los valores


a0 = 6 − 4 2
y0 = 2 − 1
• Después se itera con las siguientes fórmulas

1 − (1 − y k )1 / 4
4

y k +1 =
1 + (1 − y k )1 / 4
4

ak +1 = ak (1 + yk +1 ) 4 − 2 2 k +3 yk +1 (1 + yk +1 + y 2 k +1 )
Se tiene que ak posee una convergencia cuártica 1/π; es decir, en cada iteración se
multiplica por cuatro, aproximadamente, el número de dígitos correcto.

El grado de convergencia se obtiene de la siguiente desigualdad:


1
− an ≤ 16(4 n )(e − 2π 4 )
n

π
ALGORITMO DE BAILEY-BORWEIN-PLOUFFE

La fórmula de Bailey-Borwein-Plouffe (BBP formula) está relacionada con el cálculo del


número π. Fue descubierta en 1995 por Simon Plouffe. Junto con esta fórmula se han ido
descubriendo muchas otras que poseen la siguiente forma:

p(k )
α =∑ k
k =0 b q(k )

Y que se conocen con el nombre genérico de fórmulas BBP, estando sus límites
relacionados con constantes matemáticas fundamentales.

La fórmula original de π es:



1 4 2 1 1
π =∑ ( − − −
k =0 16
k
8k + 1 8k + 4 8k + 5 8k + 6
Lo sorprendente es que esta fórmula permite el cálculo de cualquier dígito del número π sin
necesidad de calcular ningún otro dígito (si se hace el cálculo de π en hexadecimal.

EVALUACIÓN DE ALGORITMOS
BAILEY-BORWEIN-
N° WALLIS BORWEIN
PLOUFFE
1 3.1 2,66666667 4
2 3.14 2,84444444 2,66666667
3 3.142 2,92571429 3,46666667
4 3.1416 2,9721542 2,8952381
5 3.14159 3,00217595 3,33968254
6 3.141593 3,02317019 2,97604618
7 3.1415927 3,03867363 3,28373848
8 3.14159265 3,05059 3,01707182
9 3.141592654 3,06003455 3,25236593
10 3.1415926543 3,06770381 3,04183962
700 3.1415926534 3,14047166 3,14016408
1398 3.1415926534 3,1410311 3,14087735
1399 3.1415926534 3,1410315 3,14230745

--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL -8-
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

Ejercicio de Aplicación
MATLAB: ONE.fig

MATLAB: ONE.m
% ONE M-file for ONE.fig
function varargout = ONE(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ONE_OpeningFcn, ...
'gui_OutputFcn', @ONE_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end

% --- Executes just before ONE is made visible.


function ONE_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
set(handles.uipanel1,'visible','on')
[X, Y] = meshgrid(-10:.5:10);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
surf(X, Y,Z, 'FaceColor', 'interp', 'EdgeColor', 'none', 'FaceLighting',
'phong')
view(-60,30)
camlight left
axis off
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL -9-
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

% --- Outputs from this function are returned to the command line.
function varargout = ONE_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
TWO
close(ONE)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
quit

MATLAB: TWO.fig

MATLAB: TWO.m
% TWO M-file for TWO.fig % See also: GUIDE, GUIDATA, GUIHANDLES
function varargout = TWO(varargin) % Copyright 2002-2003 The MathWorks, Inc.
% TWO M-file for TWO.fig % Edit the above text to modify the response help TWO
% TWO, by itself, creates a new TWO or raises the existing % Last Modified by GUIDE v2.5 18-Aug-2006 11:48:40
% singleton*. % Begin initialization code - DO NOT EDIT
% H = TWO returns the handle to a new TWO or the handle to gui_Singleton = 1;
% the existing singleton*. gui_State = struct('gui_Name', mfilename, ...
% TWO('CALLBACK',hObject,eventData,handles,...) calls the 'gui_Singleton', gui_Singleton,
local ...
% function named CALLBACK in TWO.M with the given input 'gui_OpeningFcn', @TWO_OpeningFcn,
arguments. ...
% TWO('Property','Value',...) creates a new TWO or raises 'gui_OutputFcn', @TWO_OutputFcn,
the ...
% existing singleton*. Starting from the left, property 'gui_LayoutFcn', [] , ...
value pairs are 'gui_Callback', []);
% applied to the GUI before TWO_OpeningFunction gets if nargin && ischar(varargin{1})
called. An gui_State.gui_Callback = str2func(varargin{1});
% unrecognized property name or invalid value makes end
property application if nargout
% stop. All inputs are passed to TWO_OpeningFcn [varargout{1:nargout}] = gui_mainfcn(gui_State,
% --- Executes just before TWO is made visible. varargin{:});
via varargin. else
% *See GUI Options on GUIDE's Tools menu. Choose gui_mainfcn(gui_State, varargin{:});
"GUI allows only one end
% instance to run (singleton)". % End initialization code - DO NOT EDIT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL - 10 -
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

function TWO_OpeningFcn(hObject, eventdata, handles, if ispc


varargin) set(hObject,'BackgroundColor','white');
% This function has no output args, see OutputFcn. else
% hObject handle to figure set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
% eventdata reserved - to be defined in a future version ackgroundColor'));
of MATLAB end
% handles structure with handles and user data (see
GUIDATA) function edit3_Callback(hObject, eventdata, handles)
% varargin command line arguments to TWO (see VARARGIN) % hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future
% Choose default command line output for TWO version of MATLAB
handles.output = hObject; % handles structure with handles and user data (see
GUIDATA)
% Update handles structure
guidata(hObject, handles); % Hints: get(hObject,'String') returns contents of
edit3 as text
% UIWAIT makes TWO wait for user response (see UIRESUME) % str2double(get(hObject,'String')) returns
% uiwait(handles.figure1); contents of edit3 as a double

% --- Outputs from this function are returned to the % --- Executes during object creation, after setting
command line. all properties.
function varargout = TWO_OutputFcn(hObject, eventdata, function edit3_CreateFcn(hObject, eventdata, handles)
handles) % hObject handle to edit3 (see GCBO)
% varargout cell array for returning output args (see % eventdata reserved - to be defined in a future
VARARGOUT); version of MATLAB
% hObject handle to figure % handles empty - handles not created until after
% eventdata reserved - to be defined in a future version all CreateFcns called
of MATLAB
% handles structure with handles and user data (see % Hint: edit controls usually have a white background
GUIDATA) on Windows.
% See ISPC and COMPUTER.
% Get default command line output from handles structure if ispc
varargout{1} = handles.output; set(hObject,'BackgroundColor','white');
else
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO) set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
% eventdata reserved - to be defined in a future version ackgroundColor'));
of MATLAB end
% handles structure with handles and user data (see
GUIDATA) function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% Hints: get(hObject,'String') returns contents of edit1 % eventdata reserved - to be defined in a future
as text version of MATLAB
% str2double(get(hObject,'String')) returns % handles structure with handles and user data (see
contents of edit1 as a double GUIDATA)

% --- Executes during object creation, after setting all % Hints: get(hObject,'String') returns contents of
properties. edit4 as text
function edit1_CreateFcn(hObject, eventdata, handles) % str2double(get(hObject,'String')) returns
% hObject handle to edit1 (see GCBO) contents of edit4 as a double
% eventdata reserved - to be defined in a future version
of MATLAB % --- Executes during object creation, after setting
% handles empty - handles not created until after all all properties.
CreateFcns called function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% Hint: edit controls usually have a white background on % eventdata reserved - to be defined in a future
Windows. version of MATLAB
% See ISPC and COMPUTER. % handles empty - handles not created until after
if ispc all CreateFcns called
set(hObject,'BackgroundColor','white');
else % Hint: edit controls usually have a white background
on Windows.
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg % See ISPC and COMPUTER.
roundColor')); if ispc
end set(hObject,'BackgroundColor','white');
else
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO) set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
% eventdata reserved - to be defined in a future version ackgroundColor'));
of MATLAB end
% handles structure with handles and user data (see
GUIDATA) function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% Hints: get(hObject,'String') returns contents of edit2 % eventdata reserved - to be defined in a future
as text version of MATLAB
% str2double(get(hObject,'String')) returns % handles structure with handles and user data (see
contents of edit2 as a double GUIDATA)

% --- Executes during object creation, after setting all % Hints: get(hObject,'String') returns contents of
properties. edit5 as text
function edit2_CreateFcn(hObject, eventdata, handles) % str2double(get(hObject,'String')) returns
% hObject handle to edit2 (see GCBO) contents of edit5 as a double
% eventdata reserved - to be defined in a future version
of MATLAB % --- Executes during object creation, after setting
% handles empty - handles not created until after all all properties.
CreateFcns called function edit5_CreateFcn(hObject, eventdata, handles)
% Hint: edit controls usually have a white background on % hObject handle to edit5 (see GCBO)
Windows. % eventdata reserved - to be defined in a future
% See ISPC and COMPUTER. version of MATLAB
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL - 11 -
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

% handles empty - handles not created until after all


CreateFcns called % --- Executes during object creation, after setting
all properties.
% Hint: edit controls usually have a white background on function edit8_CreateFcn(hObject, eventdata, handles)
Windows. % hObject handle to edit8 (see GCBO)
% See ISPC and COMPUTER. % eventdata reserved - to be defined in a future
if ispc version of MATLAB
set(hObject,'BackgroundColor','white'); % handles empty - handles not created until after
else all CreateFcns called

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg % Hint: edit controls usually have a white background


roundColor')); on Windows.
end % See ISPC and COMPUTER.
if ispc
function edit6_Callback(hObject, eventdata, handles) set(hObject,'BackgroundColor','white');
% hObject handle to edit6 (see GCBO) else
% eventdata reserved - to be defined in a future version
of MATLAB set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
% handles structure with handles and user data (see ackgroundColor'));
GUIDATA) end

% Hints: get(hObject,'String') returns contents of edit6 function edit9_Callback(hObject, eventdata, handles)


as text % hObject handle to edit9 (see GCBO)
% str2double(get(hObject,'String')) returns % eventdata reserved - to be defined in a future
contents of edit6 as a double version of MATLAB
% handles structure with handles and user data (see
% --- Executes during object creation, after setting all GUIDATA)
properties.
function edit6_CreateFcn(hObject, eventdata, handles) % Hints: get(hObject,'String') returns contents of
% hObject handle to edit6 (see GCBO) edit9 as text
% eventdata reserved - to be defined in a future version % str2double(get(hObject,'String')) returns
of MATLAB contents of edit9 as a double
% handles empty - handles not created until after all
CreateFcns called % --- Executes during object creation, after setting
all properties.
% Hint: edit controls usually have a white background on function edit9_CreateFcn(hObject, eventdata, handles)
Windows. % hObject handle to edit9 (see GCBO)
% See ISPC and COMPUTER. % eventdata reserved - to be defined in a future
if ispc version of MATLAB
set(hObject,'BackgroundColor','white'); % handles empty - handles not created until after
else all CreateFcns called

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg % Hint: edit controls usually have a white background


roundColor')); on Windows.
end % See ISPC and COMPUTER.
if ispc
function edit7_Callback(hObject, eventdata, handles) set(hObject,'BackgroundColor','white');
% hObject handle to edit7 (see GCBO) else
% eventdata reserved - to be defined in a future version
of MATLAB set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
% handles structure with handles and user data (see ackgroundColor'));
GUIDATA) end

% Hints: get(hObject,'String') returns contents of edit7 function edit10_Callback(hObject, eventdata, handles)


as text % hObject handle to edit10 (see GCBO)
% str2double(get(hObject,'String')) returns % eventdata reserved - to be defined in a future
contents of edit7 as a double version of MATLAB
% handles structure with handles and user data (see
% --- Executes during object creation, after setting all GUIDATA)
properties.
function edit7_CreateFcn(hObject, eventdata, handles) % Hints: get(hObject,'String') returns contents of
% hObject handle to edit7 (see GCBO) edit10 as text
% eventdata reserved - to be defined in a future version % str2double(get(hObject,'String')) returns
of MATLAB contents of edit10 as a double
% handles empty - handles not created until after all
CreateFcns called % --- Executes during object creation, after setting
all properties.
% Hint: edit controls usually have a white background on function edit10_CreateFcn(hObject, eventdata, handles)
Windows. % hObject handle to edit10 (see GCBO)
% See ISPC and COMPUTER. % eventdata reserved - to be defined in a future
if ispc version of MATLAB
set(hObject,'BackgroundColor','white'); % handles empty - handles not created until after
else all CreateFcns called

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg % Hint: edit controls usually have a white background


roundColor')); on Windows.
end % See ISPC and COMPUTER.
if ispc
function edit8_Callback(hObject, eventdata, handles) set(hObject,'BackgroundColor','white');
% hObject handle to edit8 (see GCBO) else
% eventdata reserved - to be defined in a future version
of MATLAB set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
% handles structure with handles and user data (see ackgroundColor'));
GUIDATA) end

% Hints: get(hObject,'String') returns contents of edit8 function edit11_Callback(hObject, eventdata, handles)


as text % hObject handle to edit11 (see GCBO)
% str2double(get(hObject,'String')) returns % eventdata reserved - to be defined in a future
contents of edit8 as a double version of MATLAB
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL - 12 -
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
% handles structure with handles and user data (see ackgroundColor'));
GUIDATA) end

% Hints: get(hObject,'String') returns contents of edit11 function edit14_Callback(hObject, eventdata, handles)


as text % hObject handle to edit14 (see GCBO)
% str2double(get(hObject,'String')) returns % eventdata reserved - to be defined in a future
contents of edit11 as a double version of MATLAB
% handles structure with handles and user data (see
% --- Executes during object creation, after setting all GUIDATA)
properties.
function edit11_CreateFcn(hObject, eventdata, handles) % Hints: get(hObject,'String') returns contents of
% hObject handle to edit11 (see GCBO) edit14 as text
% eventdata reserved - to be defined in a future version % str2double(get(hObject,'String')) returns
of MATLAB contents of edit14 as a double
% handles empty - handles not created until after all
CreateFcns called % --- Executes during object creation, after setting
all properties.
% Hint: edit controls usually have a white background on function edit14_CreateFcn(hObject, eventdata, handles)
Windows. % hObject handle to edit14 (see GCBO)
% See ISPC and COMPUTER. % eventdata reserved - to be defined in a future
if ispc version of MATLAB
set(hObject,'BackgroundColor','white'); % handles empty - handles not created until after
else all CreateFcns called

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg % Hint: edit controls usually have a white background


roundColor')); on Windows.
end % See ISPC and COMPUTER.
if ispc
function edit12_Callback(hObject, eventdata, handles) set(hObject,'BackgroundColor','white');
% hObject handle to edit12 (see GCBO) else
% eventdata reserved - to be defined in a future version
of MATLAB set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
% handles structure with handles and user data (see ackgroundColor'));
GUIDATA) end

% Hints: get(hObject,'String') returns contents of edit12 % --- Executes on button press in pushbutton1.
as text function pushbutton1_Callback(hObject, eventdata,
% str2double(get(hObject,'String')) returns handles)
contents of edit12 as a double % hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future
% --- Executes during object creation, after setting all version of MATLAB
properties. % handles structure with handles and user data (see
function edit12_CreateFcn(hObject, eventdata, handles) GUIDATA)
% hObject handle to edit12 (see GCBO) % --- Executes on button press in pushbutton2.
% eventdata reserved - to be defined in a future version function pushbutton2_Callback(hObject, eventdata,
of MATLAB handles)
% handles empty - handles not created until after all % hObject handle to pushbutton2 (see GCBO)
CreateFcns called % eventdata reserved - to be defined in a future
version of MATLAB
% Hint: edit controls usually have a white background on % handles structure with handles and user data (see
Windows. GUIDATA)
% See ISPC and COMPUTER. % --- Executes on button press in pushbutton3.
if ispc function pushbutton3_Callback(hObject, eventdata,
set(hObject,'BackgroundColor','white'); handles)
else % hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg version of MATLAB
roundColor')); % handles structure with handles and user data (see
end GUIDATA)

function edit13_Callback(hObject, eventdata, handles) % --- Executes on button press in pushbutton4.


% hObject handle to edit13 (see GCBO) function pushbutton4_Callback(hObject, eventdata,
% eventdata reserved - to be defined in a future version handles)
of MATLAB % hObject handle to pushbutton4 (see GCBO)
% handles structure with handles and user data (see % eventdata reserved - to be defined in a future
GUIDATA) version of MATLAB
% handles structure with handles and user data (see
% Hints: get(hObject,'String') returns contents of edit13 GUIDATA)
as text %n=str2double(get(handles.edit2,'String');
% str2double(get(hObject,'String')) returns n=str2double(get(handles.edit2,'String'));
contents of edit13 as a double if isnan(n)
% --- Executes during object creation, after setting all %set(handles.edit2,'String',0);
properties. errordlg('INGRESE UN NUMERO del 1 al 20','Error
ingresar numero');
function edit13_CreateFcn(hObject, eventdata, handles) end
% hObject handle to edit13 (see GCBO) pipi=num2str(pi,n)
% eventdata reserved - to be defined in a future version set(handles.edit1,'String',pipi)
of MATLAB
% handles empty - handles not created until after all %wallis:
CreateFcns called r=1:30;
walli=2.*prod((4.*(r.^2))./((4.*(r.^2))-1));
% Hint: edit controls usually have a white background on wallis=num2str(walli,n);
Windows. set(handles.edit4,'String',wallis)
% See ISPC and COMPUTER. %leibniz:
if ispc j=0:30;
set(hObject,'BackgroundColor','white'); leib=4.*sum(((-1).^j)./(2.*j+1));
else leibniz=num2str(leib,n);
set(handles.edit5,'String',leibniz)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL - 13 -
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

%euler: %error producto representativo1:


eule=2.*sum(((2.^j).*(factorial(j).^2))./factorial(2.*j+1) valormatlab=str2double(get(handles.edit1,'String'));
); editprod1=str2double(get(handles.edit11,'String'));
euler=num2str(eule,n); erro8=abs(valormatlab - editprod1 );
set(handles.edit6,'String',euler) error8=num2str(erro8,n);
%series 1 set(handles.edit22,'String',error8)
s=0:30; %error producto representativo2:
seri=sum([[((- valormatlab=str2double(get(handles.edit1,'String'));
1).^s)./(4.^s)].*[(2./(4.*s+2))+(1./(4.*s+3))+(2./(4.*s+1) editprod2=str2double(get(handles.edit12,'String'));
)]]); erro9=abs(valormatlab - editprod2 );
series=num2str(seri,n); error9=num2str(erro9,n);
set(handles.edit7,'String',series) set(handles.edit23,'String',error9)
%series 2: %error producto representativo3:
m=0:30; valormatlab=str2double(get(handles.edit1,'String'));
seri2=(1/sqrt(2)).*sum([[((- editprod3=str2double(get(handles.edit13,'String'));
1).^m)./(8.^m)].*[(1./(6.*m+3))+(1./(6.*m+5))+(4./(6.*m+1) erro10=abs(valormatlab - editprod3 );
)]]); error10=num2str(erro10,n);
series2=num2str(seri2,n); set(handles.edit24,'String',error10)
set(handles.edit8,'String',series2) %hallando la desviacion estandar:
%fourier1: e1=str2double(get(handles.edit15,'String'));
d=1:30; e2=str2double(get(handles.edit16,'String'));
fouri=2+2.*sum((sin(2.*d))./d); e3=str2double(get(handles.edit17,'String'));
fourier1=num2str(fouri,n); e4=str2double(get(handles.edit18,'String'));
set(handles.edit9,'String',fourier1) e5=str2double(get(handles.edit19,'String'));
%fourier2: e6=str2double(get(handles.edit20,'String'));
z=0:30; e7=str2double(get(handles.edit21,'String'));
fouri2=4.*sum([(-1).^z].*[cos((2.*z+1).*5.1)]./[2.*z+1]); e8=str2double(get(handles.edit22,'String'));
fourier2=num2str(fouri2,n); e9=str2double(get(handles.edit23,'String'));
set(handles.edit10,'String',fourier2) e10=str2double(get(handles.edit24,'String'));
%productos representativo 1: desviacion=sqrt(((e1.^2)+(e2.^2)+(e3.^2)+(e4.^2)+(e5.^
u=1:30; 2)+(e6.^2)+(e7.^2)+(e8.^2)+(e9.^2)+(e10.^2))./9)
produc1=sqrt(6.*sum((1)./(u.^2))); s2=num2str(desviacion,n);
producto1=num2str(produc1,n); set(handles.edit25,'String',s2)
set(handles.edit11,'String',producto1) guidata(hObject,handles)
%productos representativo 2:
w=0:30; function edit15_Callback(hObject, eventdata, handles)
produc2=(8./(1+sqrt(2))).*sum((1./(8.*w+1))- % hObject handle to edit15 (see GCBO)
(1./(8.*w+7))); % eventdata reserved - to be defined in a future
producto2=num2str(produc2,n); version of MATLAB
set(handles.edit12,'String',producto2) % handles structure with handles and user data (see
%productos representativo 3: GUIDATA)
t=0:30;
produc3=3.*sqrt(3).*sum(((-1).^t)./(3.*t+1))- % Hints: get(hObject,'String') returns contents of
log(2).*sqrt(3); edit15 as text
producto3=num2str(produc3,n); % str2double(get(hObject,'String')) returns
set(handles.edit13,'String',producto3) contents of edit15 as a double
%calculando errores:
%error wallis: % --- Executes during object creation, after setting
valormatlab=str2double(get(handles.edit1,'String')); all properties.
editwallis=str2double(get(handles.edit4,'String')); function edit15_CreateFcn(hObject, eventdata, handles)
erro1=abs(valormatlab - editwallis ); % hObject handle to edit15 (see GCBO)
error1=num2str(erro1,n); % eventdata reserved - to be defined in a future
set(handles.edit15,'String',error1) version of MATLAB
%error liebniz: % handles empty - handles not created until after
valormatlab=str2double(get(handles.edit1,'String')); all CreateFcns called
editlibniz=str2double(get(handles.edit5,'String'));
erro2=abs(valormatlab - editlibniz ); % Hint: edit controls usually have a white background
error2=num2str(erro2,n); on Windows.
set(handles.edit16,'String',error2) % See ISPC and COMPUTER.
%error Euler: if ispc
valormatlab=str2double(get(handles.edit1,'String')); set(hObject,'BackgroundColor','white');
editeuler=str2double(get(handles.edit6,'String')); else
erro3=abs(valormatlab - editeuler );
error3=num2str(erro3,n); set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
set(handles.edit17,'String',error3) ackgroundColor'));
%error serie1: end
valormatlab=str2double(get(handles.edit1,'String'));
editserie1=str2double(get(handles.edit7,'String')); function edit16_Callback(hObject, eventdata, handles)
erro4=abs(valormatlab - editserie1 ); % hObject handle to edit16 (see GCBO)
error4=num2str(erro4,n); % eventdata reserved - to be defined in a future
set(handles.edit18,'String',error4) version of MATLAB
%error serie2: % handles structure with handles and user data (see
valormatlab=str2double(get(handles.edit1,'String')); GUIDATA)
editserie2=str2double(get(handles.edit8,'String'));
erro5=abs(valormatlab - editserie2 ); % Hints: get(hObject,'String') returns contents of
error5=num2str(erro5,n); edit16 as text
set(handles.edit19,'String',error5) % str2double(get(hObject,'String')) returns
%error fourier1: contents of edit16 as a double
valormatlab=str2double(get(handles.edit1,'String'));
editfourier1=str2double(get(handles.edit9,'String')); % --- Executes during object creation, after setting
erro6=abs(valormatlab - editfourier1 ); all properties.
error6=num2str(erro6,n); function edit16_CreateFcn(hObject, eventdata, handles)
set(handles.edit20,'String',error6) % hObject handle to edit16 (see GCBO)
%error fourier2: % eventdata reserved - to be defined in a future
valormatlab=str2double(get(handles.edit1,'String')); version of MATLAB
editfourier2=str2double(get(handles.edit10,'String')); % handles empty - handles not created until after
erro7=abs(valormatlab - editfourier2 ); all CreateFcns called
error7=num2str(erro7,n); % Hint: edit controls usually have a white background
set(handles.edit21,'String',error7) on Windows.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL - 14 -
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

% See ISPC and COMPUTER. % eventdata reserved - to be defined in a future


if ispc version of MATLAB
set(hObject,'BackgroundColor','white'); % handles empty - handles not created until after
else all CreateFcns called

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg % Hint: edit controls usually have a white background


roundColor')); on Windows.
end % See ISPC and COMPUTER.
if ispc
function edit17_Callback(hObject, eventdata, handles) set(hObject,'BackgroundColor','white');
% hObject handle to edit17 (see GCBO) else
% eventdata reserved - to be defined in a future version
of MATLAB set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
% handles structure with handles and user data (see ackgroundColor'));
GUIDATA) end

% Hints: get(hObject,'String') returns contents of edit17 function edit20_Callback(hObject, eventdata, handles)


as text % hObject handle to edit20 (see GCBO)
% str2double(get(hObject,'String')) returns % eventdata reserved - to be defined in a future
contents of edit17 as a double version of MATLAB
% handles structure with handles and user data (see
% --- Executes during object creation, after setting all GUIDATA)
properties.
function edit17_CreateFcn(hObject, eventdata, handles) % Hints: get(hObject,'String') returns contents of
% hObject handle to edit17 (see GCBO) edit20 as text
% eventdata reserved - to be defined in a future version % str2double(get(hObject,'String')) returns
of MATLAB contents of edit20 as a double
% handles empty - handles not created until after all
CreateFcns called % --- Executes during object creation, after setting
all properties.
% Hint: edit controls usually have a white background on function edit20_CreateFcn(hObject, eventdata, handles)
Windows. % hObject handle to edit20 (see GCBO)
% See ISPC and COMPUTER. % eventdata reserved - to be defined in a future
if ispc version of MATLAB
set(hObject,'BackgroundColor','white'); % handles empty - handles not created until after
else all CreateFcns called

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg % Hint: edit controls usually have a white background


roundColor')); on Windows.
end % See ISPC and COMPUTER.
if ispc
function edit18_Callback(hObject, eventdata, handles) set(hObject,'BackgroundColor','white');
% hObject handle to edit18 (see GCBO) else
% eventdata reserved - to be defined in a future version
of MATLAB set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
% handles structure with handles and user data (see ackgroundColor'));
GUIDATA) end

% Hints: get(hObject,'String') returns contents of edit18 function edit21_Callback(hObject, eventdata, handles)


as text % hObject handle to edit21 (see GCBO)
% str2double(get(hObject,'String')) returns % eventdata reserved - to be defined in a future
contents of edit18 as a double version of MATLAB
% handles structure with handles and user data (see
% --- Executes during object creation, after setting all GUIDATA)
properties.
function edit18_CreateFcn(hObject, eventdata, handles) % Hints: get(hObject,'String') returns contents of
% hObject handle to edit18 (see GCBO) edit21 as text
% eventdata reserved - to be defined in a future version % str2double(get(hObject,'String')) returns
of MATLAB contents of edit21 as a double
% handles empty - handles not created until after all
CreateFcns called
% --- Executes during object creation, after setting
% Hint: edit controls usually have a white background on all properties.
Windows. function edit21_CreateFcn(hObject, eventdata, handles)
% See ISPC and COMPUTER. % hObject handle to edit21 (see GCBO)
if ispc % eventdata reserved - to be defined in a future
set(hObject,'BackgroundColor','white'); version of MATLAB
else % handles empty - handles not created until after
all CreateFcns called
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg
roundColor')); % Hint: edit controls usually have a white background
end on Windows.
% See ISPC and COMPUTER.
function edit19_Callback(hObject, eventdata, handles) if ispc
% hObject handle to edit19 (see GCBO) set(hObject,'BackgroundColor','white');
% eventdata reserved - to be defined in a future version else
of MATLAB
% handles structure with handles and user data (see set(hObject,'BackgroundColor',get(0,'defaultUicontrolB
GUIDATA) ackgroundColor'));
end
% Hints: get(hObject,'String') returns contents of edit19
as text function edit22_Callback(hObject, eventdata, handles)
% str2double(get(hObject,'String')) returns % hObject handle to edit22 (see GCBO)
contents of edit19 as a double % eventdata reserved - to be defined in a future
version of MATLAB
% --- Executes during object creation, after setting all % handles structure with handles and user data (see
properties. GUIDATA)
function edit19_CreateFcn(hObject, eventdata, handles) % Hints: get(hObject,'String') returns contents of
% hObject handle to edit19 (see GCBO) edit22 as text
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP
UNIVERSIDAD NACIONAL DE SAN CRISTÓBAL DE HUAMANGA
FACULTAD : INGENIERÍA DE MINAS, GEOLOGÍA Y CIVIL
ESCUELA : INGENIERÍA CIVIL - 15 -
ASIGNATURA : MÉTODOS NUMÉRICOS (IC-343)
PROFESOR : ING. CRISTIAN CASTRO P. FECHA: Setiembre - 2010

% str2double(get(hObject,'String')) returns % hObject handle to pushbutton5 (see GCBO)


contents of edit22 as a double % eventdata reserved - to be defined in a future
version of MATLAB
% --- Executes during object creation, after setting all % handles structure with handles and user data (see
properties. GUIDATA)
function edit22_CreateFcn(hObject, eventdata, handles) quit
% hObject handle to edit22 (see GCBO)
% eventdata reserved - to be defined in a future version function edit25_Callback(hObject, eventdata, handles)
of MATLAB % hObject handle to edit25 (see GCBO)
% handles empty - handles not created until after all % eventdata reserved - to be defined in a future
CreateFcns called version of MATLAB
% handles structure with handles and user data (see
% Hint: edit controls usually have a white background on GUIDATA)
Windows.
% See ISPC and COMPUTER. % Hints: get(hObject,'String') returns contents of
if ispc edit25 as text
set(hObject,'BackgroundColor','white'); % str2double(get(hObject,'String')) returns
else contents of edit25 as a double

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg % --- Executes during object creation, after setting


roundColor')); all properties.
end function edit25_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit25 (see GCBO)
function edit23_Callback(hObject, eventdata, handles) % eventdata reserved - to be defined in a future
% hObject handle to edit23 (see GCBO) version of MATLAB
% eventdata reserved - to be defined in a future version % handles empty - handles not created until after
of MATLAB all CreateFcns called
% handles structure with handles and user data (see
GUIDATA) % Hint: edit controls usually have a white background
on Windows.
% Hints: get(hObject,'String') returns contents of edit23 % See ISPC and COMPUTER.
as text if ispc
% str2double(get(hObject,'String')) returns set(hObject,'BackgroundColor','white');
contents of edit23 as a double else

% --- Executes during object creation, after setting all set(hObject,'BackgroundColor',get(0,'defaultUicontrolB


properties. ackgroundColor'));
function edit23_CreateFcn(hObject, eventdata, handles) end
% hObject handle to edit23 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles empty - handles not created until after all
CreateFcns called

% Hint: edit controls usually have a white background on


Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg
roundColor'));
end

function edit24_Callback(hObject, eventdata, handles)


% hObject handle to edit24 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles structure with handles and user data (see
GUIDATA)

% Hints: get(hObject,'String') returns contents of edit24


as text
% str2double(get(hObject,'String')) returns
contents of edit24 as a double

% --- Executes during object creation, after setting all


properties.
function edit24_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit24 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles empty - handles not created until after all
CreateFcns called

% Hint: edit controls usually have a white background on


Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackg
roundColor'));
end

% --- Executes on button press in pushbutton5.


function pushbutton5_Callback(hObject, eventdata, handles)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNSCH – FIMGC - DAIMC CCP

Potrebbero piacerti anche