Академический Документы
Профессиональный Документы
Культура Документы
matemática
MATLAB: Inecuaciones y precisión aritmética.
Junio 2012
1
Matlab
Inecuaciones
2
Matlab
Inecuaciones
3
Matlab
Inecuaciones
4
Matlab
Precisión aritmética
5
Matlab
Precisión aritmética
Ejemplo:
>> format long
1/2 + 1/3
ans =
0.833333333333333
>> sym(1/2) + 1/3
ans =
5/6
>> digits(25)
>> vpa('1/2 + 1/3')
ans =
0.8333333333333333333333333
6
Matlab
Precisión aritmética
Ejemplo:
>> format short;
>> A = [1.1,1.2,1.3;2.1,2.2,2.3;3.1,3.2,3.3]
A=
1.1000 1.2000 1.3000
2.1000 2.2000 2.3000
3.1000 3.2000 3.3000
>> S = sym(A)
S=
[ 11/10, 6/5, 13/10]
[ 21/10, 11/5, 23/10]
[ 31/10, 16/5, 33/10]
7
Matlab
Precisión aritmética
Ejemplo:
>> E = [exp(1) (1 + sqrt(5))/2; log(3) rand]
E=
2.7183 1.6180
1.0986 0.6324
>> sym(E)
ans =
[ 3060513257434037/1125899906842624,
910872158600853/562949953421312]
[ 2473854946935173/2251799813685248,
1423946432832521/2251799813685248]
8
Matlab
Precisión aritmética
Ejemplo:
>> vpa(S)
ans =
[ 1.1, 1.2, 1.3]
[ 2.1, 2.2, 2.3]
[ 3.1, 3.2, 3.3]
>> digits(25)
>> F = vpa(E)
F=
[ 2.718281828459045534884808,
1.618033988749894902525739]
[ 1.098612288668109560063613,
0.6323592462254095103446616]
9
Matlab
Precisión aritmética
Ejemplo:
>> f = sym('exp(pi*sqrt(163))')
>> format long; double(f)
ans =
2.625374126407687e+017
>> vpa(f,18)
ans =
262537412640768744.0
>> vpa(f,25)
ans =
262537412640768744.0
vpa(f,30)
ans =
262537412640768743.999999999999
10