Professional Documents
Culture Documents
2016-I
REPRESENTACIN BINARIA
257.76 2 10 5 10 7 10 7 10 6 10
2
http://numericalmethods.eng.usf.edu
Base 2
(1 23 0 2 2 1 21 1 2 0 )
(1011.0011) 2
1
2
3
4
(
0
2
)
11.1875
10
5/2
2/2
1/2
Por lo tanto
Resto
1 a0
1 a1
0 a2
1 a3
(11)10 ( a 3 a 2 a1 a 0 ) 2
(1011) 2
Start
Integer N to be converted to
binary format
Input (N)10
i=0
i=i+1,N=Q
ai = R
No
Is Q = 0?
Yes
n=i
(N)10 = (an. . .a0)2
STOP
Number
Number
despues
decimal
0.1875 2
0.375
0.375
0 a1
0.375 2
0.75
0.75
0 a 2
0.75 2
1.5
0.5
1 a 3
0.5 2
1.0
0.0
1 a 4
Number antes
decimal
Por lo tanto
(0.1875)10 ( a1a 2 a 3a 4 ) 2
7
(0.0011) 2
Start
Fraction F to be converted
to binary format
Input (F)10
i 1
Multiply F by 2 to get
number before decimal, S
and after decimal, T
i i 1, F T
ai = R
No
Is T = 0?
Yes
n=i
(F)10 = (a-1. . .a-n)2
STOP
11.1875 10
?.?
Entonces
(11)10 (1011) 2
y
(0.1875)10 (0.0011) 2
tenemos
(11.1875)10 (1011.0011) 2
9
0.3 2
0.6 2
0.2 2
0.4 2
0.8 2
Number
Number after
decimal
0.6
0.6
1.2
0.2
0.4
0.4
0.8
0.8
1.6
0.6
Number
before
Decimal
0 a1
1 a 2
0 a3
0 a 4
1 a 5
11.187510
to base 2
1110 23 3
23 21 1
2 2 2
3
1 2 0 2 1 2 1 2
1011 2
3
11
0.187510 2
0.0625
2 2
0 2 1 0 2 2 1 2 3 1 2 4
.0011 2
11.187510 1011.0011 2
12
13
14
15
Ejemplo
La forma es:
o
m 10e
Ejemplo: Para
2.5678 10 2
1
m 2.5678
e2
16
sign mantissa 10
exponent
y m2
sign of number 0 for ve, 1 for - ve
m mantissa 1 2 m 10 2
e
e integer exponent
17
Ejemplo
Palabra hipotetica de 9 bits
the
the
the
the
54.75 10
110110.11 2 1.1011011 2 25
1.1011 2 101 2
mantissa
Sign of the
number
18
Sign of the
exponent
exponent
Epsilon de la Maquina
Definido como la medida de exactitud y
calculado por diferencia entre 1 y el nmero
siguiente que pueden ser representados
19
Example
Diez bit word
Signo del numero
Signo del exponente
Siguiente cuatro bits para el exponente
Siguiente cuatro bits para la mantissa
Next
number
1 10
1.0001 2 1.0625 10
mach 1.0625 1 2 4
20
Example
0.02832 10 1.1100 2 2 5
1.1100 2 2 0110
Sign of the
number
exponent
Sign of the
exponent
mantissa
1.1100 2 2 0110
a
21
0.0274375
0.02832 0.0274375
0.02832
0.034472 2 4 0.0625
REFERENCIA IMPORTANTE
Cada profesional en ciencia e ingeniera (e
incluso si usted no lo es) debe saber sobre
aritmtica de punto flotante!
Sign Biased
(s) Exponent (e)
Mantissa (m)
Value ( 1) 1 m 2 2
s
25
e ' 127
Example#1
1 1 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Sign Biased
(s) Exponent (e)
Mantissa (m)
1 1.10100000 2 2
1 1.625 2162127
1 1.625 235 5.5834 1010
1
26
(10100010) 2 127
Example#2
Represent -5.5834x1010 as a
precision floating point number.
single
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
Sign Biased
(s) Exponent (e)
Mantissa (m)
5.5834 10 1 1. ? 2
10
27
0 e 255
Bias is 127; so subtract 127 from
representation
127 e 128
28
Actual range of
1 e 254
e 0
and
e 255
Actual range of
126 e 127
e 0
e 255
all zeros
all ones
m
Represents
all zeros
all zeros
all zeros
all zeros
-0
all ones
all zeros
all ones
all zeros
0 or 1
all ones
non-zero
NaN
IEEE-754 Format
The largest number by magnitude
1.1........1 2 2
127
3.40 10
38
1.00......0 2 2
126
2.18 10
38
Machine epsilon
mach 2
31
23
1.19 10
32
Fuentes de ERROR
33
34
2 1.4142...
35
36
Problema
con el Misil Patriot
El ciclo de reloj de 1/10 de segundos
fue
representado en registro de punto fijo 24-bit
cre un error de 9,5 x 10 -8 segundos.
9.5 108
s
3600s
100hr
0.1s
1hr
0.342 s
37
38
Tc
(T ) dT
Ta
39
D D T
40
T(oF)
(in/in/oF)
-340
2.45
-300
3.07
-220
4.08
-160
4.72
-80
5.43
6.00
40
6.24
80
6.47
42
T(oF)
(in/in/oF)
Given
(in/in/oF)
Predicted
-340
2.45
2.76
-300
3.07
3.26
-220
4.08
4.18
-160
4.72
4.78
-80
5.43
5.46
6.00
6.02
40
6.24
6.26
80
6.47
6.46
44
T(oF)
(in/in/oF)
Given
(in/in/oF)
Predicted
-340
2.45
2.46
-300
3.07
3.03
-220
4.08
4.05
-160
4.72
4.70
-80
5.43
5.44
6.00
6.02
40
6.24
6.25
80
6.47
6.45
45
(in/in/oF)
Given
(in/in/oF)
Predicted
(in/in/oF)
Predicted
-340
2.45
2.46
2.76
-300
3.07
3.03
3.26
-220
4.08
4.05
4.18
-160
4.72
4.70
4.78
-80
5.43
5.44
5.46
6.00
6.02
6.02
40
6.24
6.25
6.26
80
6.47
6.45
6.46
Error de Truncamieno
46
Truncation error
Error Causado por Truncamiento o aproximado
en un procedimiento matemtico.
47
approximate
2
3
x
x
e x 1 x ....................
2! 3!
x
x
Truncation Error e 1 x
2!
48
f (x)
to approximate
f ( x)
f ( x x) f ( x)
x
secant line
P
tangent line
Q
49
50
e1.2
with an absolute
1.2
1.2 2 1.2 3
1 1.2
...................
2!
3!
e1.2
Ea
a %
__
___
2.2
1.2
54.545
2.92
0.72
24.658
3.208
0.288
8.9776
3.2944
0.0864
2.6226
3.3151
0.020736
0.62550
6 terms are required. How many are required to get at least 1 significant
digit correct in your answer?
51
Example 2 Differentiation
Find
and
f (3)
for
f ( x) x 2
x 0.2
f ' (3)
using
f ( x)
f (3 0.2) f (3)
0.2
f (3.2) f (3)
3.2 2 32
0.2
0.2
The actual value is
f ( x x) f ( x)
x
f ' ( x ) 2 x,
10.24 9
1.24
6. 2
0.2
0. 2
f ' (3) 2 3 6
6 6.2 0.2
x 0.1
52
Example 3 Integration
Use two rectangles of equal width to approximate the area under the
curve for
f ( x) x 2
[3,9]
2
x
dx
3
53
2
2
x
dx
(
x
)
x 3
(6 3) ( x 2 )
x 6
(9 6)
(3 2 )3 (6 2 )3
27 108 135
Actual value is given by
9
x3
2
3 x dx 3
93 33
234
3
234 135 99
Can you find the truncation error with 4 rectangles?
54
Medicion de Errores
55
PORQUE MEDIR
ERRORES?
Para determinar la exactitud del resultados
numrico.
Para desarrollar
iterativos.
56
los
criterios
de
algoritmos
ERROR VERDADERO
Definido como la diferencia entre el valor verdadero
obtenido en un clculo y el valor aproximado
encontrado con un mtodo numrico etc.
57
ExampleTrue Error
f (x)
The derivative,
can be
f ( x) 7e 0.5 x
and
f ( x h) f ( x)
h
h 0.3
58
f (x)
If
of a function
f ' ( 2)
f ' ( 2)
Solution:
a) For
x2
and
h 0.3
f ( 2 0.3) f ( 2)
f ' ( 2)
0. 3
f (2.3) f (2)
0.3
7e 0.5( 2.3) 7e 0.5( 2 )
0.3
22.107 19.028
0.3
59
10.263
Solution:
f ' ( 2)
f ( x) 7e 0.5 x
f ' ( x ) 7 0.5 e 0.5 x
3.5e 0.5 x
f ' ( 2)
Et
is
Error Relativo
Verdadero
Error.Verdadero
r
Valor.Verdadero
61
f ' (2)
with
h 0.3
Et 0.722
Relative True Error is defined as
0.722
9.5140
0.075888
as a percentage,
t 0.075888 100%
62
7.5888%
True Error
True Value
Error de aproximacion
63
ExampleApproximate Error
f ( x) 7e 0.5 x
For
a)
f (2)
using
h 0.3
b)
f (2)
using
h 0.15
Solution:
a) For
x2
and
h 0.3
f ( x h) f ( x)
f ' ( x)
h
f ' ( 2)
64
f ( 2 0.3) f ( 2)
0.3
f (2)
for part b)
f (2.3) f (2)
0 .3
(cont.)
0 .3
0.3
b) For
x2
and
f ' ( 2)
h 0.15
f (2 0.15) f ( 2)
0.15
f (2.15) f (2)
0.15
65
(cont.)
7e 0.5( 2.15) 7e 0.5( 2 )
0.15
20.50 19.028
0.15
9.8800
Ea
is
9.8800 10.263
0.38300
66
Ea
67
Error . Aproximado
Aproximacion.acual
For
x2
h 0.3
and
h 0.15
Solution:
f (2) 10.263
Ea
h 0.3
and
using
9.8800 10.263
0.38300
68
f (2) 9.8800
h 0.15
cont.
Approximate Error
Present Approximation
as a percentage,
0.38300
9.8800
0.038765
69
|a | s
where
|a | 0.5 10 2m %
70
Table of Values
For
71
f ( x) 7e 0.5 x
f (2)
0.3
10.263
N/A
0.15
9.8800
3.877%
0.10
9.7558
1.273%
0.01
9.5378
2.285%
0.001
9.5164
0.2249%
72
REPASO DE LA SERIE DE
TAYLOR
WIWIDATA ING.
73
Qu es la serie de Taylor?
Algunos de los ejemplos de la serie de Taylor que Ud. debe
haber visto
x2 x4 x6
cos( x) 1
2! 4! 6!
x3 x5 x7
sin( x) x
3! 5! 7!
2
x
x
e 1 x
2! 3!
x
74
WIWIDATA ING.
f x h f x f x h
f x 2 f x 3
h
h
2!
3!
75
WIWIDATA ING.
ExampleTaylor Series
f 6
f 4 30,
of
f x
f 4 6
at
given that
f 4 125,
f 4 74,
x4
are zero.
Solution:
x4
h2
h3
f x h f x f x h f x f x
2!
3!
h 64 2
76
WIWIDATA ING.
Solution: (cont.)
Since the higher order derivatives are zero,
22
23
f 4 2 f 4 f 4 2 f 4
f 4
2!
3!
22
23
6
f 6 125 74 2 30
2!
3!
125 148 60 8 341
Note that to find
f 6
of the function and all its derivatives at some other point, in this case
x4
77
WIWIDATA ING.
2
3
x
x
ex 1 x
2! 3!
The Maclaurin series is simply the Taylor series about the point
x=0
h2
h3
h4
h5
f x h f x f x h f x
f x
f x
f x
2!
3!
4
5
h2
h3
h4
h5
f 0 h f 0 f 0 h f 0
f 0
f 0
f 0
2!
3!
4
5
78
WIWIDATA ING.
Since
(e 0 ) 2
(e 0 ) 3
f ( h ) (e ) ( e ) h
h
h ...
2!
3!
0
1 2 1 3
1 h h h ...
2!
3!
So,
79
x 2 x3
f ( x) 1 x ...
2! 3!
WIWIDATA ING.
where
x c xh
Rn
n 1
x h
x
80
WIWIDATA ING.
(n 1)!
f n 1 c
ex
at point
x0
is given by
2
3
4
5
x
x
x
x
ex 1 x
2! 3! 4! 5!
81
WIWIDATA ING.
Solution:
Using
n 1
n 1
x h
Rn x
n 1!
n 1
0 1
Rn 0
n 1!
n 1
x 0, h 1, f ( x ) e x
f n 1 c
n 1
ec
n 1!
Since
x c xh
0 c 0 1
0 c 1
82
1
e
Rn 0
(n 1)!
(n 1)!
WIWIDATA ING.
bound of
Solution: (cont.)
So if we want to find out how many terms it would
e1
within a
10 6
(n 1)! 10 6 e
(n 1)! 10 6 3
n9
So 9 terms or more are needed to get a true error
10 6
less than
83
WIWIDATA ING.
84
PROPAGACION DE
ERRORES
85
Propagacion de errores
En mtodos numricos, los clculos no
se hacen con nmeros exactos. Cmo
estas inexactitudes se propagan en los
clculos?
86
Example 1:
Encontrar los limites de Propagacion en la suma de dos numeros. Ejemplo si
uno esta calculando X +Y donde
X = 1.5 0.05
Y = 3.4 0.04
Solution
Maximum possible value of X = 1.55 y Y = 3.44
Maximum possible value of X+Y=1.55+3.44=4.99
Minimum possible value of X=1.45 y Y = 3.36.
Minimum possible value of X+Y=1.45+3.36=4.81
Por lo tanto
4.81 X + Y 4.99.
87
Propagacin de errores en
frmulas
SI f es una funcin de varias variables x1, x2, x3, .xn-1,
xn
entonces el valor mximo posible del error en f esta
dado:
f
f
f
f
f
X 1
X 2 .......
X n 1
X n
X 1
X 2
X n 1
X n
88
Example 2:
La tensin en un miembro axial de una seccin
representativa cuadrada esta dado:
F
2
h E
Encuentre el error mximo posible mximo en la
medida de la
la tension.
F 72 0.9 N
h 4 0.1 mm
E 70 1.5 GPa
89
Solucion
72
3 2
9
( 4 10 ) (70 10 )
64.286 10
64.286
F
h
E
F
h
E
90
2F
3
h
h E
1
2
F h E
F
2 2
E
h E
as
1
2F
F
E 2 F 3 h 2 2 E
h E
hE
h E
1
2 72
0.9
0.0001
( 4 10 3 ) 2 (70 109 )
( 4 10 3 ) 3 (70 10 9 )
72
9
1
.
5
10
( 4 10 3 ) 2 (70 109 ) 2
5.3955
Por lo tanto
91
(64.286 5.3955 )
Example 3:
La substraccin de los nmeros que son muy cercanos o casi iguales crea
inexactitudes indeseadas. Usaremos la frmula para la propagacin de
error, el cual se demuestra que esto es verdad.
Solution
Sea:
Entonces:
z x y
z
z
z
x
y
x
y
(1)x (1)y
x y
El cambio relativo esta dado por:
x y
z
z
x y
92
x 2 0.001
y 2.003 0.001
0.001 0.001
z
z
| 2 2.003 |
= 0.6667
= 66.67%
93