math
This package extends Asymptote
's mathematical capabilities with
useful functions such as
void drawline(picture pic=currentpicture, pair P, pair Q, pen p=currentpen);
P
and Q
, without altering the size of picture pic
,
using pen p
.
real intersect(triple P, triple Q, triple n, triple Z);
PQ
with the plane perpendicular to n
and passing through Z
.
triple intersectionpoint(triple n0, triple P0, triple n1, triple P1);
n0
and n1
passing through points P0
and P1
,
respectively. If the planes are parallel, return
(infinity,infinity,infinity)
.
pair[] quarticroots(real a, real b, real c, real d, real e);
pair[][] fft(pair[][] a, int sign=1)
sign
.
real time(path g, real x, int n=0)
n
th intersection time of path g
with the vertical
line through x.
real time(path g, explicit pair z, int n=0)
n
th intersection time of path g
with the horizontal
line through (0,z.y)
.
real value(path g, real x, int n=0)
n
th y
value of g
at x
.
real value(path g, real x, int n=0)
n
th x
value of g
at y=z.y
.
real slope(path g, real x, int n=0)
n
th slope of g
at x
.
real slope(path g, explicit pair z, int n=0)
n
th slope of g
at y=z.y
.
int[][] segment(bool[] b)
returns the indices of consecutive true-element segments of bool[] b
.
real[] partialsum(real[] a)
a
.
real[] partialsum(real[] a, real[] dx)
dx
-weighted sums of a real array a
.
bool increasing(real[] a, bool strict=false)
strict=false
, whether i > j
implies
a[i] >= a[j]
, or if strict=true
, whether i > j
implies
implies a[i] > a[j]
.
int unique(real[] a, real x)
a
does not contain x
, insert it
sequentially, returning the index of x
in the resulting array.
bool lexorder(pair a, pair b)
a
and b
.
bool lexorder(triple a, triple b)
a
and b
.