33 lines
692 B
Plaintext
33 lines
692 B
Plaintext
SUB euler (paso)
|
|
LET tiempo = 0
|
|
LET temperatura = 100
|
|
PRINT USING "Step ## ": paso;
|
|
DO WHILE tiempo <= 100
|
|
IF (REMAINDER(tiempo,10)) = 0 THEN PRINT USING "###.##": temperatura;
|
|
LET temperatura = temperatura+paso*(-.07*(temperatura-20))
|
|
LET tiempo = tiempo+paso
|
|
LOOP
|
|
PRINT
|
|
END SUB
|
|
|
|
PRINT "Time ";
|
|
LET tiempo = 0
|
|
DO WHILE tiempo <= 100.1
|
|
PRINT USING "######": tiempo;
|
|
LET tiempo = tiempo+10
|
|
LOOP
|
|
PRINT
|
|
PRINT "Dif eq ";
|
|
LET tiempo = 0
|
|
DO WHILE tiempo <= 100.1
|
|
LET temperatura = 20+(100-20)*EXP(-.07*tiempo)
|
|
PRINT USING "###.##": temperatura;
|
|
LET tiempo = tiempo+10
|
|
LOOP
|
|
PRINT
|
|
|
|
CALL Euler (2)
|
|
CALL Euler (5)
|
|
CALL Euler (10)
|
|
END
|