Task units are similar to packages in that a task declaration defines entities exported from the task, whereas its body contains local declarations and statements of the task.

A single task is declared as follows:

```
task Single is
declarations of exported identifiers
end Single;
...
task body Single is
local declarations and statements
end Single;
```

A task declaration can be simplified, if nothing is exported, thus:

```
task No_Exports;
procedure Housekeeping is
task Check_CPU;
task Backup_Disk;
task body Check_CPU is
...
end Check_CPU;
task body Backup_Disk is
...
end Backup_Disk;
-- the two tasks are automatically created and begin execution
begin -- Housekeeping
null;
-- Housekeeping waits here for them to terminate
end Housekeeping;
```

It is possible to declare task types, thus allowing task units to be created dynamically, and incorporated in data structures:

```
task type T is
...
end T;
...
Task_1, Task_2 : T;
...
task body T is
...
end T;
```

Task types are *limited*, i.e. they are restricted in the same way as limited private types, so assignment and comparison are not allowed.

A render of a 6-cube.

Source: Wikipedia

]]>An ornamental design of five alternately interlaced pentagons (a kind of five-fold counterpart to the three-fold Valknut). No two pentagons are directly interlinked, and any three adjacent pentagons (for example, red, blue and turquoise) are in a Borromean rings configuration, which means that two non-adjacent pentagons will have to be removed in order to free the remaining three.

```
%!
306 396 translate 12.5 setlinewidth/plr{.25 sub 2.47213472 12.5
mul mul dup 3 2 roll 72 mul 90 add dup 3 1 roll cos mul 3 1 roll
sin mul}def/P{4 4 plr 3 4 plr 2 4 plr 1 4 plr 0 4 plr moveto
4{lineto}repeat closepath stroke}def/half{plr currentpoint exch
4 1 roll exch .4 mul exch .6 mul add 3 1 roll .4 mul exch .6 mul
add exch lineto stroke}def
gsave 0 .75 .75 setrgbcolor 3.7526379 2.5 plr translate P grestore
gsave 0 0 1 setrgbcolor 4.7526379 2.5 plr translate P grestore
gsave 1 0 .2 setrgbcolor 0.7526379 2.5 plr translate P grestore
gsave 0 .9 0 setrgbcolor 2.7526379 2.5 plr translate P grestore
gsave 0 .75 .75 setrgbcolor 3.7526379 2.5 plr translate
3 4 plr moveto 2 4 half 2 4 plr moveto 1 4 half
1 4 plr moveto 2 4 half 0 4 plr moveto 1 4 half grestore
gsave 0 0 1 setrgbcolor 4.7526379 2.5 plr translate
3 4 plr moveto 2 4 half 1 4 plr moveto 2 4 half grestore
gsave 1 0 .2 setrgbcolor 0.7526379 2.5 plr translate
4 4 plr moveto 3 4 half 2 4 plr moveto 3 4 half grestore
showpage
%EOF
```

Source: Wikipedia

]]>In mathematics and especially in combinatorics, a plane partition is a two-dimensional array of nonnegative integers $$ n_{i,j}} n_ $$ (with positive integer indices i and j) that is nonincreasing in both indices, that is, that satisfies for all i and j, and for which only finitely many of the ni,j are nonzero. A plane partitions may be represented visually by the placement of a stack of unit cubes above each other giving a three-dimensional solid like the one shown at right.

Source: Wikipedia

]]>Note to C++ programmers: generic units are similar to C++ templates.

For example, to define a procedure for swapping variables of any (non-limited) type:

```
generic
type Element_T is private; -- Generic formal type parameter
procedure Swap (X, Y : in out Element_T);
```

```
procedure Swap (X, Y : in out Element_T) is
Temporary : constant Element_T := X;
begin
X := Y;
Y := Temporary;
end Swap;
```

The `Swap`

subprogram is said to be generic. The subprogram specification is preceded by the generic formal part consisting of the reserved word generic followed by a list of generic formal parameters which may be empty. The entities declared as generic are not directly usable, it is necessary to instantiate them.

To be able to use `Swap`

, it is necessary to create an instance for the wanted type. For example:

`procedure Swap_Integers is new Swap (Integer);`

Now the `Swap_Integers`

procedure can be used for variables of type `Integer`

.

The generic procedure can be instantiated for all the needed types. It can be instantiated with different names or, if the same identifier is used in the instantiation, each declaration overloads the procedure:

```
procedure Instance_Swap is new Swap (Float);
procedure Instance_Swap is new Swap (Day_T);
procedure Instance_Swap is new Swap (Element_T => Stack_T);
```

Similarly, generic packages can be used, for example, to implement a stack of any kind of elements:

```
generic
Max: Positive;
type Element_T is private;
package Generic_Stack is
procedure Push (E: Element_T);
function Pop return Element_T;
end Generic_Stack;
package body Generic_Stack is
Stack: array (1 .. Max) of Element_T;
Top : Integer range 0 .. Max := 0; -- initialise to empty
-- ...
end Generic_Stack;
```

A stack of a given size and type could be defined in this way.

Source: Ada Programming

]]>

The Möbius strip or Möbius band is a surface with only one side and only one boundary. The Möbius strip has the mathematical property of being non-orientable. It can be realized as a ruled surface. It was discovered independently by the German mathematicians August Ferdinand Möbius and Johann Benedict Listing in 1858.

An example of a Möbius strip can be created by taking a paper strip and giving it a half-twist, and then joining the ends of the strip to form a loop. However, the Möbius strip is not a surface of only one exact size and shape, such as the half-twisted paper strip depicted in the illustration. Rather, mathematicians refer to the closed Möbius band as any surface that is homeomorphic to this strip. Its boundary is a simple closed curve, i.e., homeomorphic to a circle. This allows for a very wide variety of geometric versions of the Möbius band as surfaces each having a definite size and shape. For example, any rectangle can be glued to itself (by identifying one edge with the opposite edge after a reversal of orientation) to make a Möbius band. Some of these can be smoothly modeled in Euclidean space, and others cannot.

A half-twist clockwise gives an embedding of the Möbius strip different from that of a half-twist counterclockwise — that is, as an embedded object in Euclidean space the Möbius strip is a chiral object with right- or left-handedness. However, the underlying topological spaces within the Möbius strip are homeomorphic in each case. There are an infinite number of topologically different embeddings of the same topological space into three-dimensional space, as the Möbius strip can also be formed by twisting the strip an odd number of times greater than one, or by knotting and twisting the strip, before joining its ends. The complete open Möbius band is an example of a topological surface that is closely related to the standard Möbius strip but that is not homeomorphic to it.

It is straightforward to find algebraic equations, the solutions of which have the topology of a Möbius strip, but in general these equations do not describe the same geometric shape that one gets from the twisted paper model described above. In particular, the twisted paper model is a developable surface, having zero Gaussian curvature. A system of differential-algebraic equations that describes models of this type was published in 2007 together with its numerical solution.[4]

Source: Wikipedia

]]>In mathematics, the **Klein bottle** /ˈklaɪn/ is an example of a non-orientable surface; it is a two-dimensional manifold against which a system for determining a normal vector cannot be consistently defined. Informally, it is a one-sided surface which, if traveled upon, could be followed back to the point of origin while flipping the traveler upside down. Other related non-orientable objects include the Möbius strip and the real projective plane. Whereas a Möbius strip is a surface with boundary, a Klein bottle has no boundary (for comparison, a sphere is an orientable surface with no boundary).

$z(\theta ,\phi )=r\mathrm{sin}\theta \mathrm{cos}(\phi \mathrm{/}2)$

$w(\theta ,\phi )=r\mathrm{sin}\theta \mathrm{sin}(\phi \mathrm{/}2)$

The Klein bottle was first described in 1882 by the German mathematician Felix Klein. It may have been originally named the *Kleinsche Fläche* (“Klein surface”) and then misinterpreted as *Kleinsche Flasche* (“Klein bottle”), which ultimately may have led to the adoption of this term in the German language as well.

The following square is a fundamental polygon of the Klein bottle. The idea is to ‘glue’ together the corresponding coloured edges so that the arrows match, as in the diagrams below. Note that this is an “abstract” gluing in the sense that trying to realize this in three dimensions results in a self-intersecting Klein bottle.

$x(\theta ,\phi )=(R+r\mathrm{cos}\theta )\mathrm{cos}\phi$

$y(\theta ,\phi )=(R+r\mathrm{cos}\theta )\mathrm{sin}\phi$

$x(u,v)=-\frac{2}{15}\mathrm{cos}u(3\mathrm{cos}v-30\mathrm{sin}u+90{\mathrm{cos}}^{4}u\mathrm{sin}u\phantom{\rule{1em}{0ex}}$

$y(u,v)=-\frac{1}{15}\mathrm{sin}u(3\mathrm{cos}v-3{\mathrm{cos}}^{2}u\mathrm{cos}v-48{\mathrm{cos}}^{4}u\mathrm{cos}v+48{\mathrm{cos}}^{6}u$

$z(u,v)=\frac{2}{15}(3+5\mathrm{cos}u\mathrm{sin}u)\mathrm{sin}v$

Source: Wikipedia

]]>```
2.5e+3
False
"и"
null
```

Involving many of those one can write *aggregates* (a primary),

```
(X => 0.0,
Y => 1.0,
Z => 0.0)
```

Arbitrarily complex sub-components are possible, too, creating an aggregate from component expressions,

```
(Height => 1.89 * Meter,
Age => Guess (Picture => Images.Load (Suspects, "P2012-Aug.PNG"),
Tiles => Grid'(1 .. 3 => Scan, 4 => Skip)),
Name => new Nickname'("Herbert"))
```

Age is associated with the value of a nested function call. The actual parameter for Tiles has type name Grid qualify the array aggregate following it; the component Name is associated with an allocator.

The well known ‘mathematical’ expressions have closely corresponding simple expressions in Ada syntax, for example 2.0*π*r, or the relation

`Area = π*r**2`

Other expressions test for *membership* in a range, or in a type:

```
X in 1 .. 10 | 12
Shape in Polygon'Class
```

]]>In geometry, a torus (plural tori) is a surface of revolution generated by revolving a circle in three-dimensional space about an axis coplanar with the circle. If the axis of revolution does not touch the circle, the surface has a ring shape and is called a torus of revolution.

Real-world examples of toroidal objects include inner tubes, swim rings, and the surface of a ring doughnut or bagel.

A torus should not be confused with a solid torus, which is formed by rotating a disk, rather than a circle, around an axis. A solid torus is a torus plus the volume inside the torus. Real-world approximations include doughnuts, vadai or vada, many lifebuoys, and O-rings.

In topology, a ring torus is homeomorphic to the Cartesian product of two circles: S1 × S1, and the latter is taken to be the definition in that context. It is a compact 2-manifold of genus 1. The ring torus is one way to embed this space into three-dimensional Euclidean space, but another way to do this is the Cartesian product of the embedding of S1 in the plane. This produces a geometric object called the Clifford torus, a surface in 4-space.

In the field of topology, a torus is any topological space that is topologically equivalent to a torus.

Source: Wikipedia

]]>

A polygon discovered by Robert Amman, formed from a regular hexagon by adding projections on two of its sides and matching indentations on three sides. It may be surrounded by four layers of congruent copies of itself, but not five. See Heesch’s problem.

Source: Wikipedia

]]>- objects (of mode
*in*or*in out*but never*out*) - types
- subprograms
- instances of another, designated, generic unit.

When instantiating the generic, the programmer passes one actual parameter for each formal. Formal values and subprograms can have defaults, so passing an actual for them is optional.

Formal parameters of mode *in* accept any value, constant, or variable of the designated type. The actual is copied into the generic instance, and behaves as a constant inside the generic; this implies that the designated type cannot be limited. It is possible to specify a default value, like this:

```
generic
Object : in Natural := 0;
```

For mode *in out*, the actual must be a variable. One limitation with generic formal objects is that they are never considered static, even if the actual happens to be static. If the object is a number, it cannot be used to create a new type. It can however be used to create a new derived type, or a subtype:

```
generic
Size : in Natural := 0;
package P is
type T1 is mod Size; -- illegal!
type T2 is range 1 .. Size; -- illegal!
type T3 is new Integer range 1 .. Size; -- OK
subtype T4 is Integer range 1 .. Size; -- OK
end P;
```

The reason why formal objects are nonstatic is to allow the compiler to emit the object code for the generic only once, and to have all instances share it, passing it the address of their actual object as a parameter. This bit of compiler technology is called *shared generics*. If formal objects were static, the compiler would have to emit one copy of the object code, with the object embedded in it, for each instance, potentially leading to an explosion in object code size (code bloat).

(Note to C++ programmers: in C++, since formal objects can be static, the compiler cannot implement shared generics in the general case; it would have to examine the entire body of the generic before deciding whether or not to share its object code. In contrast, Ada generics are designed so that the compiler can instantiate a generic *without looking at its body*.)

The syntax allows the programmer to specify which type categories are acceptable as actuals. As a rule of thumb: The syntax expresses how the generic sees the type, i.e. it assumes the worst, not how the creator of the instance sees the type.

This is the syntax of RM 12.5

```
formal_type_declaration ::=
type defining_identifier[discriminant_part] is formal_type_definition;
formal_type_definition ::= formal_private_type_definition
| formal_derived_type_definition
| formal_discrete_type_definition
| formal_signed_integer_type_definition
| formal_modular_type_definition
| formal_floating_point_definition
| formal_ordinary_fixed_point_definition
| formal_decimal_fixed_point_definition
| formal_array_type_definition
| formal_access_type_definiton
| formal_interface_type_definition
```

This is quite complex, so some examples are given below. A type declared with the syntax `type T (<>)`

denotes a type with unknown discriminants. This is the Ada vernacular for indefinite types, i.e. types for which objects cannot be declared without giving an initial expression. An example of such a type is one with a discriminant without default, another example is an unconstrained array type.

In the body we can only use the operations predefined for the type category of the formal parameter. That is, the generic specification is a contract between the generic implementor and the client instantiating the generic unit. This is different to the parametric features of other languages, such as C++.

It is possible to further restrict the set of acceptable actual types like so:

Generic formal type | Acceptable actual types |
---|---|

`type T (<>) is` … |
Definite or indefinite types (loosely speaking: types with or without discriminants, but other forms of indefiniteness exist) |

`type T (D : DT) is` … |
Types with a discriminant of type DT (it is possible to specify several discriminants, too) |

`type T is` … |
Definite types (loosely speaking types without a discriminant or with a discriminant with default value) |

Source: Ada Programming

]]>The Euclidean algorithm developed for two Gaussian integers α and β is nearly the same as that for normal integers, but differs in two respects. As before, the task at each step *k* is to identify a quotient *q*_{k} and a remainder *r*_{k} such that where *r*_{k−2} = α, *r*_{k−1} = β, and every remainder is strictly smaller than its predecessor, |*r*_{k}| < |*r*_{k−1}|. The first difference is that the quotients and remainders are themselves Gaussian integers, and thus are [complex numbers]. The quotients *q*_{k} are generally found by rounding the real and complex parts of the exact ratio (such as the complex number α/β) to the nearest integers.[^5] The second difference lies in the necessity of defining how one complex remainder can be “smaller” than another. To do this, a [norm function]
*f*(*u* + *v*i) = *u*^{2} + *v*^{2} is defined, which converts every Gaussian integer *u* + *vi* into a normal integer. After each step *k* of the Euclidean algorithm, the norm of the remainder *f*(*r*_{k}) is smaller than the norm of the preceding remainder, *f*(*r*_{k−1}). Since the norm is a nonnegative integer and decreases with every step, the Euclidean algorithm for Gaussian integers ends in a finite number of steps.

A monochrome render of a Truncated dodecahedron by Olfa Wektoryzacja, 2007.

Source: Wikipedia

]]>`type T is...`

followed by the description of the type, as explained in detail in each category of type.

Formally, the above declaration creates a type and its first subtype named T. The type itself, correctly called the “type of T”, is anonymous; the RM refers to it as T (in italics), but often speaks sloppily about the type T. But this is an academic consideration; for most purposes, it is sufficient to think of T as a type. For scalar types, there is also a base type called T’Base, which encompasses all values of T.

For signed integer types, the type of T comprises the (complete) set of mathematical integers. The base type is a certain hardware type, symmetric around zero (except for possibly one extra negative value), encompassing all values of T.

As explained above, all types are incompatible; thus:

```
type Integer_1 is range 1 .. 10;
type Integer_2 is range 1 .. 10;
A : Integer_1 := 8;
B : Integer_2 := A; -- illegal!
```

is illegal, because `Integer_1`

and `Integer_2`

are different and incompatible types. It is this feature which allows the compiler to detect logic errors at compile time, such as adding a file descriptor to a number of bytes, or a length to a weight. The fact that the two types have the same range does not make them compatible: this is name equivalence in action, as opposed to structural equivalence. (Below, we will see how you can convert between incompatible types; there are strict rules for this.)

Contours around a saddle point. Selfmade with Mathematica and Inkscape.

Source: Wikipedia

]]>The mpl colormaps: magma, inferno, plasma and viridis. I previously attempted to implement these in the Cubehelix color space, but the originals are much better. You could presumably plug these colors into a D3 quantize scale, if you were so inclined.

Source: Matplotlib Colormaps

]]>Ahh, my eyes! A deliberately retina-searing variation of the coastal graph distance map.

Source: Mike Bostock

```
var projection = d3.geo.albersUsa()
.translate([width / 2, height / 2]);
var path = d3.geo.path()
.projection(projection);
var color = d3.scale.ordinal()
.domain(d3.range(9).reverse())
.range(["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
queue()
.defer(d3.json, "/mbostock/raw/4090846/us.json")
.defer(d3.tsv, "coastal-counties.tsv")
.await(ready);
function ready(error, us, coastals) {
if (error) throw error;
var counties = topojson.feature(us, us.objects.counties),
neighbors = topojson.neighbors(us.objects.counties.geometries),
coastals = d3.set(coastals.map(function(d) { return d.id; })),
nexts = [],
nexts2 = [],
distance = 0;
counties.features.forEach(function(county, i) {
if (coastals.has(county.id)) nexts.push(county);
county.distance = Infinity;
county.neighbors = neighbors[i].map(function(j) { return counties.features[j]; });
});
while (nexts.length) {
nexts.forEach(function(county) {
if (county.distance > distance) {
county.distance = distance;
county.neighbors.forEach(function(neighbor) { nexts2.push(neighbor); });
}
});
nexts = nexts2, nexts2 = [], ++distance;
}
var county = svg.append("g")
.attr("class", "counties")
.selectAll("path")
.data(d3.nest()
.key(function(d) { return d.distance; })
.entries(counties.features)
.map(function(e) { return {type: "FeatureCollection", features: e.values, distance: +e.key}; }))
.enter().append("path")
.attr("d", path);
d3.timer(function(elapsed) {
county.style("fill", function(d) { return d3.hsl(d.distance * 10 - elapsed / 10, 1, .5); });
});
}
```

]]>

Un des 9 groupes non-abéliens d’ordre 16 est le produit semi-direct de C_2^2 par C_4. On peut dessiner le graphe de Cayley de cette présentation sur une surface de genre 1, qui sera divisée en 8 régions, et coloriée avec 4 couleurs.

Source: Wikipedia

]]>

A plot of the bowl function $f(x) = x^2 + y^2$

Source: Wikipedia

]]>