36 lines
703 B
Plaintext
36 lines
703 B
Plaintext
print "Time ";
|
|
tiempo = 0.0
|
|
while tiempo <= 100.1
|
|
print tiempo using "#######";
|
|
tiempo = tiempo + 10.0
|
|
wend
|
|
print
|
|
|
|
print "Dif eq ";
|
|
tiempo = 0.0
|
|
while tiempo <= 100.1
|
|
temperatura = 20.0 + (100.0-20.0) * exp(-0.07*tiempo)
|
|
print temperatura using "####.##";
|
|
tiempo = tiempo + 10.0
|
|
wend
|
|
print
|
|
|
|
Euler_(2)
|
|
Euler_(5)
|
|
Euler_(10)
|
|
end
|
|
|
|
sub Euler_(paso)
|
|
local tiempo, temperatura
|
|
tiempo = 0
|
|
temperatura = 100.0
|
|
print "Step ", paso using "##", " ";
|
|
|
|
while tiempo <= 100
|
|
if mod(tiempo, 10) = 0 print temperatura using "####.##";
|
|
temperatura = temperatura + (paso) * (-0.07*(temperatura-20.0))
|
|
tiempo = tiempo + paso
|
|
end while
|
|
print
|
|
end sub
|