23 lines
531 B
Text
23 lines
531 B
Text
|
|
"Euler Solution"
|
|||
|
|
T ← 100 # initial starting temp
|
|||
|
|
TR ← 20 # room temp
|
|||
|
|
TMINUSTR ← - TR T
|
|||
|
|
h ← 10 # step size
|
|||
|
|
k ← 0.07 # coefficent
|
|||
|
|
TEND ← 100 # end time
|
|||
|
|
n ← ÷ h 100 # steps
|
|||
|
|
# inital starting point
|
|||
|
|
T
|
|||
|
|
.
|
|||
|
|
# .. clone the top of stack and take if for next step
|
|||
|
|
# repeat the steps n times with ⍥
|
|||
|
|
Solution ← [⍥(.. - × h × k - TR)]+ n 1
|
|||
|
|
⇌ ⊂ Solution T
|
|||
|
|
|
|||
|
|
# analytical solution
|
|||
|
|
"Analytical Solution"
|
|||
|
|
# apply function to LIST
|
|||
|
|
List ← × k × h ⇡n
|
|||
|
|
# Analytical solution applied
|
|||
|
|
+ TR × TMINUSTR ⁿ ¯List e
|