




























































































Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!





























































































IF x < 10 THEN
IF x < 5 THEN
x = 5
PRINT x
IF x < 50 EXIT
x = x - 5
start
sum = 0
count = 0
INPUT
value
value =
“end of data”
value =
“end of data”
sum = sum + value
count = count + 1
T
F
count > 0
average = sum/count
end
T
F
i
i
n 2 1
1
−
=
∑
i- 1
2i- 1
start
INPUT
x, n
i > n
end
i = 1
true = sin(x)
approx = 0
factor = 1
approx approx
x
factor
i
i -
2 1
OUTPUT
i,approx,error
i = i + 1
F
T
factor=factor(2i-2)(2i-1)
SUBROUTINE Sincomp(n,x)
i = 1
true = SIN(x)
approx = 0
factor = 1
IF i > n EXIT
approx = approx + (-1)
i-
2
i-
/ factor
error = Abs(true - approx) / true) * 100
PRINT i, true, approx, error
i = i + 1
factor = factor • (2 • i-2) • (2 • i-1)
t
Dim V1 As Single, v2 As Single, pi As Single
pi = 4 * Atn(1)
If d < R Then
Vol = pi * d ^ 3 / 3
ElseIf d <= 3 * R Then
V1 = pi * R ^ 3 / 3
v2 = pi * R ^ 2 * (d - R)
Vol = V1 + v
Else
Vol = "overtop"
End If
End Function
R d Volume
1 3.1 overtop
Function Polar(x, y)
2 2
x < 0
y > 0 y > 0
θ + π
−
x
y
1
tan
θ − π
−
x
y 1
tan
θ −π
−
x
y 1
tan
θ = 0
π
θ =−
y < 0
θ = π
y < 0
Polar
Polar
End Polar
T
T
T
T
T
F
F
F
F
Option Explicit
Function Polar(x, y)
Dim th As Single, r As Single
Const pi As Single = 3.
r = Sqr(x ^ 2 + y ^ 2)
If x < 0 Then
If y > 0 Then
th = Atn(y / x) + pi
ElseIf y < 0 Then
th = Atn(y / x) - pi
Else
th = pi
End If
Else
If y > 0 Then
th = pi / 2
ElseIf y < 0 Then
th = -pi / 2
Else
th = 0
End If
End If
Polar = th * 180 / pi
End Function
x y θ
IV
st
nd
rd
th
nd
rd
th
x=0:0.001:3.2;
f=x-1-0.5*sin(x) ;
subplot(2,2,1);
plot(x,f);grid;title('f(x)=x-1-0.5*sin(x)');hold on
f1=x-1.5 ;
e1=abs(f-f1); %Calculates the absolute value of the
difference/error
subplot(2,2,2);
plot(x,e1);grid;title('1st Order Taylor Series Error');
f2=x-1.5+0.25.((x-0.5pi).^2);
e2=abs(f-f2);
subplot(2,2,3);
plot(x,e2);grid;title('2nd/3rd Order Taylor Series Error');
f4=x-1.5+0.25.((x-0.5pi).^2)-(1/48)((x-0.5pi).^4);
e4=abs(f4-f);
subplot(2,2,4);
plot(x,e4);grid;title('4th Order Taylor Series Error');hold off