`ak`

library, taking inspiration from the C++ standard library. Now, JavaScript isn't just short of algorithms in its standard library, it's also lacking all but a few data structures. In fact, from the programmer's perspective, it only has hash maps which use a function to map strings to non-negative integers that are then used as indices into an array of sets of key-value pairs. Technically speaking, even arrays are hash maps of the string representation of their indices, although in practice the interpreter will use more efficient data structures whenever it can.As clever as its implementation might be, it's unlikely that it will always figure out exactly what we're trying to do and pick the most appropriate data structure and so it will occasionally be worth explicitly implementing a data structure so that we can be

The first such data structure that we're going to need is a min-heap which will allow us to efficiently add elements in any order and remove them in ascending order, according to some comparison function. ]]>

Like all copulas they are effectively the CDFs of vector valued random variables whose elements are uniformly distributed when considered independently. Whilst those Archimedean CDFs were relatively trivial to implement, we found that their probability density functions, or PDFs, were somewhat more difficult and that the random variables themselves required some not at all obvious mathematical manipulation to get right.

Having done all the hard work implementing the

`ak.archimedeanCopula`

, `ak.archimedeanCopulaDensity`

and `ak.archimedeanCopulaRnd`

functions we shall now use them to implement some specific families of Archimedean copulas.
]]>
We have seen that the densities of Archimedean copulas are rather trickier to calculate and that making random observations of them is trickier still. Last time we found an algorithm for the latter, albeit with an implementation that had troubling performance and numerical stability issues, and in this post we shall add an improved version to the

`ak`

library that addresses those issues.
]]>
These are known as Archimedean copulas and are valid whenever

Whilst such copulas are relatively easy to implement we saw that their densities are a rather trickier job, in contrast to Gaussian copulas where the reverse is true. In this post we shall see how to draw random vectors from Archimedean copulas which is also much more difficult than doing so from Gaussian copulas. ]]>

Last time, in preparation for interpolating between multidimensional vector nodes, we implemented the

`ak.grid`

type to store ticks on a set of axes and map their intersections to `ak.vector`

objects to represent such nodes arranged at the corners of hyperdimensional rectangular cuboids.With this in place we're ready to take a look at one of the simplest multidimensional interpolation schemes; multilinear interpolation. ]]>

I concluded by noting that, even with this improvement, the shape of a cubic spline interpolation is governed by choices that are not uniquely determined by the points themselves and that linear interpolation is consequently a more mathematically appropriate scheme, which is why I chose to generalise it to other arithmetic types for

The obvious next question is whether or not we can also generalise the

We have also seen how extrapolating such polynomials beyond the first and last nodes can yield less than satisfactory results, which we fixed by specifying the first and last gradients and then adding new first and last nodes to ensure that the first and last polynomials would represent straight lines.

Now we shall see how cubic spline interpolation can break down rather more dramatically and how we might fix it. ]]>

In this post we shall see how we can define a smooth interpolation by connecting the points with curves rather than straight lines. ]]>

On the face of it implementing this would seem to be a pretty trivial business, but doing so both accurately and efficiently is a surprisingly tricky affair, as we shall see in this post. ]]>

`ak.borelInterval`

type to represent an interval as a pair of `ak.borelBound`

objects holding its lower and upper bounds.With these in place we're ready to implement a type to represent Borel sets and we shall do exactly that in this post. ]]>

`ak.setUnion`

and `ak.setIntersection`

respectively.Such arrays are necessarily both finite and discrete and so cannot represent continuous subsets of the real numbers such as intervals, which contain every real number within a given range. Of particular interest are unions of countable sets of intervals

`ak`

library to represent them.
]]>
`finite`

determines whether its argument is neither infinite nor NaN and `isnan`

determines whether its argument is NaN; behaviours that shouldn't be particularly surprising since they're more or less equivalent to JavaScript's `isFinite`

and `isNaN`

functions respectively.One recommended function that JavaScript does

`ak`

library, is `nextafter`

which returns the first representable floating point number after its first argument in the direction towards its second.
]]>