int
int, function
def pure int(r: ranvar, a: number, b: number): number
def pure int(z: zedfunc, a: number, b: number): number
Returns the sum of values over the inclusive segment [a, b] for a ranvar or
zedfunc.
r: ranvar to integrate.z: zedfunc to integrate.a: segment start.b: segment end.
Examples
r = poisson(3)
table T = with
[| as A, as B |]
[| 0, 0 |]
[| 0, 2 |]
[| 2, 4 |]
T.Sum = int(r, T.A, T.B)
show table "Ranvar" with
T.A
T.B
T.Sum
This produces the following table:
| A | B | Sum |
|---|---|---|
| 0 | 0 | 0.04978787 |
| 0 | 2 | 0.4231969 |
| 2 | 4 | 0.6161249 |
z = max(constant(5) - linear(1), 0)
table T = with
[| as A, as B |]
[| 0, 1 |]
[| 2, 4 |]
T.Sum = int(z, T.A, T.B)
show table "Zedfunc" with
T.A
T.B
T.Sum
This produces the following table:
| A | B | Sum |
|---|---|---|
| 0 | 1 | 9 |
| 2 | 4 | 6 |