Dt

From Esolang
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 i nitialized 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 Δ.

Examples

clear variable

; Call using Η
λ 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 incremental, 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: