Escolar Documentos
Profissional Documentos
Cultura Documentos
Prova - Tipo 4 - Gabarito
Prova - Tipo 4 - Gabarito
Aplicar no Scilab:
format (25)
dec2base(2467,8)
//ans = 4643
Base = 2
Expoente = 6
Mantissa = 7
BIAS = 27
s=0
c = 011110
Convertendo para decimal - FAZ DA DIREITA PARA A ESQUERDA:
0*2^0 + 1*2^1 + 1*2^2 + 1*2^3 + 1*2^4 + 0*2^5
2 + 4 + 8 + 16
c = 30
M = 0101110
Convertendo para decimal - FAZ DA ESQUERDA PARA A DIREITA:
1 + 0*2^-1 + 1*2^-2 + 0*2^-3 + 1*2^-4 + 1*2^-5 + 1*2^-6 + 0*2^-7
1 + 0.25 + 0.0625 + 0.03125 + 0.015625
M = 1.359375
x = (-1)^0 *1.359375*2^(30-27)
x = 1.359375*2^3
x = 10.875
Aplicar no Scilab:
format (25)
x1 = %pi^10
x = 93648
erro_rel = abs((x-x1)/x)
//ans = 0.0000005069631276912455
//ans = 5.069631276912455*10^-7 > 5*10^-7
Como o erro relativo é maior que 5*10^s, teu número de dígitos significativos é s – 1 🡪
7–1=6
Aplicar na fórmula:
|[f'(x)/f(x)]*x|
Aplicar no Scilab:
format (25)
function y = f(x)
y = exp(7*x)/sin(x) //Alterar aqui a equação
endfunction
function yl = g(x)
yl = [(-sin(x)*exp(x)) - (cos(x)*exp(x))]/(exp(x))^2 //Alterar aqui a derivada
endfunction
x = 13
abs([g(x)/f(x)]*x)
//ans = 19.019274728174366373423
function y = fl(x)
y = [27*((x^2)+1) - (27*x*2*x)]/[((x^2)+1)^2] + 1
endfunction
x=1
for n=1:10
x = x - f(x)/fl(x)
end
//ans = 25.961540831897362835434
Aplicar no Scilab:
format(25)
function y = f(x)
y = exp(-x) + (x/28) //Alterar aqui a equação
endfunction
function y=fl(x)
y = -exp(-x) + (1/28) //Alterar aqui a derivada
endfunction
function y=fll(x)
y= exp(-x)
endfunction
x=1
for n=1:20
x=x -fl(x)/fll(x)
end
//ans = 3.332204510175203804323
//deriva duas vezes pois pediu o ponto de mínimo da função
Aplicar no Scilab:
m=201;n=201 //Alterar aqui
U=[]
for i=1:m
for j=1:n
if j-i >= 0
U(i,j)=1;
end
end
end
//
//D=[]
//for i:1:n
//end
D=[]
for i=1:m
for j=1:n
if i == j
D(i,j)=1;
end
end
end
Z = zeros(n,n)
M=zeros(3*m, 3*n)
M = [D Z U;Z D Z;U Z D]
c=0
for i=1:3*m
for j=1:3*m
if M(i,j) <> 0 then
c=c+1
end
end
end
disp(c)
//ans = 41205
Aplicar no Scilab:
function [A,b] = matrix_builder(n)
M = zeros(n, n)
for i=1:n
b(i) = -429 / n^2 //Alterar aqui
for j=1:n
if (i == j)
A(i, j) = -2
end
if (abs(i-j) == 1)
A(i, j) = 1
end
end
end
endfunction
[A, b] = matrix_builder(500);
res = max(A \ b)
//ans = 53.839500