Qu

area

Builtin index · Plotting

area(x, y)

Input: x, y · Output: no output

What it is

Filled area under the curve (x, y) (equal-length numeric Vecs) down to y=0; the zero-baseline special case of fill_between.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
area(x, y)
x Vecnot documented yet
y Vecnot documented yet
no output—

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

# main.qu

import "geometry.qu"
print(area(2))            # 12.56636

not run by the build — this one needs something the repository cannot supply · from fundamentals

import "geometry.qu" as g
print(g.area(2))          # 12.56636

print(area(2))            # 12.56636 -- the bare name too

print(PI_ISH)             # 3.14159

not run by the build — this one needs something the repository cannot supply · from fundamentals

# geometry.qu

PI_ISH = 3.14159

function area(r)
    return PI_ISH * r * r
end function

from fundamentals

function area(x: num)
    return x * x
end function

function area(x: vec)
    return sum(x)
end function

print(area("hello"))

from tour

How it works

fill_between(x, y_lo, y_hi) — a filled band, e.g. a confidence interval; area(x, y) is the y_lo = 0 special case.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.