VICERRECTORADO ACADMICO
AREA: INGENIERA
TRABAJO PRCTICO
CDIGO: 337
CDULA DE IDENTIDAD:
TELFONO:
CENTRO LOCAL:
CARRERA: 236
NUMERO DE ORIGINALES:
K2=h*f(X0*1/2h, y0+1/2k1)
3,5 3,5
K2=h*(0+ 2 + 37,5 2 )
K2=h*(67, 3)
K2=100,95
K3
K4
K4=h*f(X0*h, y0+k3
K4=h*f(0+3,5,1+0,64)
K4= 4,14
t x y k1 k2 k3 k4
0 0 37,5 1406,25 2,05006834 2,47225752 1,528887
1 3,5 37,5 1418,5 -1,8261376 2,14649471 1,3866235
2 7 37,5 1455,25 0,63145044 1,87801885 1,2578753
3 10,5 37,5 1516,5 -1,4620616 1,65434219 -1,142291
7000
6000
5000
Series4
4000
Series3
3000
Series2
2000
Series1
1000
0
i x y k1 k2 k3 k4
-1000
program RK4;
{
Programa en Pascal Runge-Kutta 4
Ecuacin dy/dt = y-x
Condicin inicial: y(0) = 0
}
var
number, i : integer;
h, k1, k2, k3, k4, t, y : real;
function f(t, y : real) : real;
begin
f := k*(y - x)
end;
begin
k := 0.01;
t := 0.0;
h := 1.5;
write('minutos : ');
readln(minutos);
write('Valor inicial de y(0) = ');
readln(y);
if minutos <= 3 then
begin
writeln(' t y ');
writeln('****************************');
writeln('***', t:9:6, ' ** ', y:9:6, ' **');
for i := 1 to minutos do
begin
k1 := h*f(t,y);
k2 := h*f(t+1.5*h,y+1.5*k1);
k3 := h*f(t+1.5*h,y+1.5*k2);
k4 := h*f(t+h,y+k3);
t := t + h;
y := y + h*(k1+2*k2+2*k3+k4)/6.0;
writeln('***', t:9:6, ' ** ', y:9:6, ' **');
end;
writeln('****************************');
end;
end.
OBJETIVO 7
800
700
600
Ganancia
500
Perdida
400
Ingreso
300 Demanda
200 Compra
100
0
1 2 3 4 5 6 7