Está en la página 1de 4

UNIVERSIDAD NACIONAL DEL CENTRO DEL PERÚ

FACULTAD DE INGENIERÍA QUÍMICA


FORMATO DE LA RESOLUCION DEL EXAMEN DE APLAZADOS DE LENGUAJE DE PROGRAMACIÓN
problemas
1. Codificación en R Studio

N <- 1
C <- 520

hw <- 10/274 #(W/m^2.°C)*(1°C/274K)


Ta <- 22+273 # °C +273..K
Tpm <-x

o <- 5.67*10^-8 #W/m^2.K^4


e1 <- 0.92
e2 <- 0.92
Ut <- 10/274 #(W/m^2.°C)*(1°C/274K)

e <-430*(1-100/x)
F <- (1+0.089*hw-0.1166*hw*e2)*(1+0.07866*N)

f=function(x) ((N/((C/x)*((x-Ta)/(N+F))^(430*(1-100/x))))+1/hw)^-1 +
(o*(x+Ta)*(x^2+Ta^2))/((e2+0.000591*N*hw)^-1+(2*N+F-1+0.133*e1)/(e1) - N) - Ut
curve(f, from=0,to=1000,col="red")
abline(h=0,col="blue")
a=1
b=1000
x=(a+b)/2
i=1
cat("---------------------------------------------------------------------------\n")
cat(formatC( c("Iteracion","a","b","x","Error"),width = -16, format = "f", flag = " "), "\n")
cat("---------------------------------------------------------------------------\n")
cat(formatC( c((i), (a),(b),(x)), digits=5, width = -15, format = "f", flag = " "), "\n")

T=1*10^-4
E=2
while(E>T){
i=i+1
if(f(a)*f(x)<0)
{b=x}
else
{a=x}
x1=(a+b)/2
E=abs((x1-x)/x1)
x=x1
cat(formatC( c((i),(a) ,(b),(x),(E)), digits=5, width = -15, format = "f", flag = " "), "\n")
}
cat("---------------------------------------------------------------------------\n")
print(paste("EL VALOR DE LA RAIZ ES:",x,"EN LA ITERCION",i))
cat("---------------------------------------------------------------------------\n")

RESOLUCION SIN CONVERSION DE UNIDADES

N <- 1
C <- 520
hw <- 10 #(W/m^2.°C)*(1°C/274K)
Ta <- 22 # °C +273..K
Tpm <-x

o <- 5.67*10^-8 #W/m^2.K^4


e1 <- 0.92
e2 <- 0.92
Ut <- 10 #(W/m^2.°C)*(1°C/274K)

e <-430*(1-100/x)
F <- (1+0.089*hw-0.1166*hw*e2)*(1+0.07866*N)

f=function(x) ((N/((C/x)*((x-Ta)/(N+F))^(430*(1-100/x))))+1/hw)^-1 +
(o*(x+Ta)*(x^2+Ta^2))/((e2+0.000591*N*hw)^-1+(2*N+F-1+0.133*e1)/(e1) - N) - Ut
curve(f, from=0,to=1000,col="red")
abline(h=0,col="blue")
a=1
b=1000
x=(a+b)/2
i=1
cat("---------------------------------------------------------------------------\n")
cat(formatC( c("Iteracion","a","b","x","Error"),width = -16, format = "f", flag = " "), "\n")
cat("---------------------------------------------------------------------------\n")
cat(formatC( c((i), (a),(b),(x)), digits=5, width = -15, format = "f", flag = " "), "\n")

T=1*10^-4
E=2
while(E>T){
i=i+1
if(f(a)*f(x)<0)
{b=x}
else
{a=x}
x1=(a+b)/2
E=abs((x1-x)/x1)
x=x1
cat(formatC( c((i),(a) ,(b),(x),(E)), digits=5, width = -15, format = "f", flag = " "), "\n")
}
cat("---------------------------------------------------------------------------\n")
print(paste("EL VALOR DE LA RAIZ ES:",x,"EN LA ITERCION",i))
cat("---------------------------------------------------------------------------\n")

Resultado.

La función tiene raíces imaginarias-… es un proceso de no convergencia


(Los grados Celsius fueron convertidos en grados Kelvin)
Si los grados Celsius se deja tal como está la función tiene solución, por lo q se estaría
quebrantando las unidades

2. Pegar el diagrama flujo


3. Codificación en R Studio

T <- 383 # K
Tc <- 105.1+273 # K
Pc <- 4060 # k Pascal = 1 KJ/m^3
R <- 0.08149 # kJ/kg.K
A <- 0.4278*(R^2)*(Tc^2.5)/Pc
B<- 0.08664*(R*Tc)/(Pc)
# v <- x
f=function(x) (R*T)/(x-B)-A/(x*(x+B)*(T^0.5))
curve(f, from=0.01856,to=0.5219,col="red")
a=0.5219 #m^3/Kg
b=0.01856 #m^3/Kg
n=20
h=(b-a)/n
I=0
for (k in 1:n-1) {
x=a+h*k
I=I+f(x)
}

I=(h/2)*(2*I+f(a)+f(b))
print(I)

Resultado.

=- 104.8978 KJ

4. Pegar el diagrama flujo

También podría gustarte