Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
42
Task/Euler-method/Gambas/euler-method.gambas
Normal file
42
Task/Euler-method/Gambas/euler-method.gambas
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue