Dt
Jump to navigation
Jump to search
Dt is a real computation language, capable of solving differential equations to infinite precision. it is also rather confusing.
Specification
| What | Explanation |
|---|---|
λ func vars: |
Define a function func with variable vars. also indents the block |
Δ func vars |
Apply a function with vars as input and set each variable to (prev * (1 - Δt) + new * Δt) |
Η func vars |
Apply a function with vars as input and set each variable to the result |
var = val |
Define a variable initialized with a value |
О label |
Jumps to a label |
Ө var |
Skips next instruction iff the variable var is strictly negative |
label: |
Makes a new label |
It also comes with two predefined functions; Inc and Dec. they are self explanatory. Note: their effects are multiplied by Δt if called with Δ.
the closer to 0 Dt is, the more precise.
Examples
clear variable
; Call using Η to clear.
λ clear v:
pos:
Δ Dec v
Ө X
О pos
neg:
Δ Inc X
Ө X
О end
О neg
end:
addition and subtraction. call using H unless you want it to be continous, then call with Δ
λ add from to:
temp = 0
l0:
Δ Dec from
Δ Dec temp
Ө from
O l0
l1:
Δ Inc from
Δ Inc temp
Ө from
O l2
O l1
l2:
Δ Dec from
Δ Dec to
Δ Dec temp
Ө temp
O l2
Δ Inc from
Δ Inc to
Δ Inc temp
Ө temp
O l3
O l2
l3:
λ sub from to:
temp = 0
l0:
Δ Dec from
Δ Dec temp
Ө from
O l0
l1:
Δ Inc from
Δ Inc temp
Ө from
O l2
O l1
l2:
Δ Dec from
Δ Inc to
Δ Dec temp
Ө temp
O l2
Δ Inc from
Δ Dec to
Δ Inc temp
Ө temp
O l3
O l2
l3:
multiplication. uses the clear, addition and subtraction function. resets B
λ mult_resB A B C:
H clear C
pos:
Δ add A C
Ө temp
O pos
neg:
Δ sub A C
Ө temp
O end
O neg
end:
Multiply input by 1/e by multiplying by (1-dt), 1/dt times. for dt = 0.005 and input 2, result is 0.7318, true result is 0.7357, and so 99% accuracy Uses the clear function in a continous way
λ dive A:
ctr = 1.0
loop:
Δ dec ctr
Δ clear v
Ө ctr
O loop