programlibs/Plot/demos/functions.xtl

A mathematical function plotted over a range, not a sequence: the horizontal axis reads x's own values. A sine wave, a parabola, and both together, titled and named. Run with "just demo Plot functions".

source · imports p: libs/Plot/src/Plot.xtl

xs : Float

value · line 8
xs ← 100 ᵖl̲inspace (0.0 − 6.28, 6.28)                 ⍝ -2pi to 2pi
Used in: wave, both, titled

wave : Char

value · line 9
wave ← ᵖf̲unction! (2 100 r̲eshape xs c̲at 's̲in e̲ach xs)

ys : Float

value · line 11
ys ← 100 ᵖl̲inspace (-3.0, 3.0)
Used in: curve, both, titled

curve : Char

value · line 12
curve ← ᵖf̲unction! (2 100 r̲eshape ys c̲at ys × ys)

both : Char

value · line 14
both ← ("sine" "parabola") ᵖf̲unctions! ((e̲nclose 2 100 r̲eshape xs c̲at 's̲in e̲ach xs) c̲at e̲nclose 2 100 r̲eshape ys c̲at ys × ys)

titled : Char

value · line 16
titled ← ("sin(x) and x^2" "x" "y" "sin(x)" "x^2") ᵖf̲unctionChart! ((e̲nclose 2 100 r̲eshape xs c̲at 's̲in e̲ach xs) c̲at e̲nclose 2 100 r̲eshape ys c̲at ys × ys)