43 lines
774 B
Plaintext
43 lines
774 B
Plaintext
Public Sub Main()
|
|
|
|
Dim tiempo As Float, temperatura As Float
|
|
|
|
Print "Time ";
|
|
tiempo = 0.0
|
|
While tiempo <= 100.1
|
|
Print Format$(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 Format$(temperatura, "####.#0");
|
|
tiempo += 10.0
|
|
Wend
|
|
Print
|
|
|
|
Euler(2)
|
|
Euler(5)
|
|
Euler(10)
|
|
|
|
End
|
|
|
|
Public Sub Euler(paso As Integer)
|
|
|
|
Dim tiempo As Integer = 0
|
|
Dim temperatura As Float = 100.0
|
|
|
|
Print "Step "; Format$(paso, "##"); " ";
|
|
|
|
Do While tiempo <= 100
|
|
If (tiempo Mod 10) = 0 Then Print Format$(temperatura, "####.#0");
|
|
temperatura += (paso) * (-0.07 * (temperatura - 20.0))
|
|
tiempo += paso
|
|
Loop
|
|
Print
|
|
|
|
End Sub
|