Message Boards Message Boards

[GIF] Elaborating on Arrival's Alien Language, Part I., II. & III.

GROUPS:
image processing mathematics physics recreation discrete mathematics equation solving geometry graphics and visualization wolfram language mathematica optimization

I recently watched "Arrival", and thought that some of the dialogue sounded Wolfram-esque. Later, I saw the following blog post:

Quick, How Might the Alien Spacecraft Work?

Along with many others, I enjoyed the movie. The underlying artistic concept for the alien language reminded me of decade old memories, a book by Stephen Addiss, Art of Zen. Asian-influenced symbolism is an interesting place to start building a sci-fi concept, even for western audiences.

I also found Cristopher Wolfram's broadcast and the associated files:

Youtube Broadcast

Github Files ( with image files )

Thanks for sharing! More science fiction, yes!

I think the constraint of circular logograms could be loosened. This leads to interesting connections with theory of functions, which I think the Aliens would probably know about.

The following code takes an alien logogram as input and outputs a deformation according to do-it-yourself formulation of the Pendulum Elliptic Functions:

Human Animation

$m=2$ Inversion Coefficients

MultiFactorial[n_, nDim_] := Times[n, If[n - nDim > 1, MultiFactorial[n - nDim, nDim], 1]]
GeneralT[n_, m_] :=  Table[(-m)^(-j) MultiFactorial[i + m (j - 1) + 1, m]/ MultiFactorial[i + 1, m], {i, 1, n}, {j, 1, i}]
a[n_] := With[{gt = GeneralT[2 n, 2]}, gt[[2 #, Range[#]]] & /@ Range[n] ]

Pendulum Values : $2(1-\cos(x))$ Expansion Coefficients

c[n_ /; OddQ[n]] := c[n] = 0;
c[n_ /; EvenQ[n]] := c[n] = 2 (n!) (-2)^(n/2)/(n + 2)!;

Partial Bell Polynomials

Note: These polynomials are essentially the same as the "BellY" ( hilarious naming convention), but recursion optimized. See timing tests below.

B2[0, 0] = 1;
B2[n_ /; n > 0, 0] := 0;
B2[0, k_ /; k > 0] := 0;
B2[n_ /; n > 0, k_ /; k > 0] := B2[n, k] = Total[
    Binomial[n - 1, # - 1] c[#] B2[n - #, k - 1] & /@ 
     Range[1, n - k + 1] ];

Function Construction

BasisT[n_] :=  Table[B2[i, j]/(i!) Q^(i + 2 j), {i, 2, 2 n, 2}, {j, 1, i/2}]
PhaseSpaceExpansion[n_] :=   Times[Sqrt[2 \[Alpha]], 1 + Dot[MapThread[Dot, {BasisT[n], a[n]}], (2 \[Alpha])^Range[n]]];
AbsoluteTiming[CES50 = PhaseSpaceExpansion[50];] (* faster than 2(s) *)
Fast50 = Compile[{{\[Alpha], _Real}, {Q, _Real}}, Evaluate@CES50];

Image Processing

note: This method is a hack from ".jpg" to sort-of vector drawing. I haven't tested V11.1 vectorization functionality, but it seems like this could be a means to process all jpg's and output a file of vector polygons. Anyone ?

LogogramData = Import["Human1.jpg"];
Logogram01 = ImageData[ColorNegate@Binarize[LogogramData, .9]];
ArrayPlot@Logogram01;

Positions1 = 
  Position[Logogram01[[5 Range[3300/5], 5 Range[3300/5]]], 1];
Graphics[{Disk[#, 1.5] & /@ Positions1, Red, 
   Disk[{3300/5/2, 3300/5/2}, 10]}];
onePosCentered = 
  N[With[{cent = {3300/5/2, 3300/5/2} }, # - cent & /@ Positions1]];
radii = Norm /@ onePosCentered;
maxR = Max@radii;
normRadii = radii/maxR;
angles = ArcTan[#[[2]], #[[1]]] & /@ onePosCentered;
Qs = Cos /@ angles;

Constructing and Printing Image Frames

AlienWavefunction[R_, pixel_, normRad_, Qs_, angles_] := Module[{
   deformedRadii = MapThread[Fast50, {R normRad, Qs}],
   deformedVectors = Map[N[{Cos[#], Sin[#]}] &, angles],
   deformedCoords
   },
  deformedCoords = 
   MapThread[Times, {deformedRadii, deformedVectors}];
  Show[ PolarPlot[ Evaluate[
     CES50 /. {Q -> Cos[\[Phi]], \[Alpha] -> #/10} & /@ 
      Range[9]], {\[Phi], 0, 2 Pi}, Axes -> False, 
    PlotStyle -> Gray],
   Graphics[Disk[#, pixel] & /@ deformedCoords], ImageSize -> 500]]

AbsoluteTiming[  OneFrame = 
   AlienWavefunction[1, (1 + 1)* 1.5/maxR, normRadii, Qs, angles]
 ](* about 2.5 (s)*)

Alien Pendulum

Validation and Timing

In this code, we're using the magic algorithm to get up to about $100$ orders of magnitude in the half energy, $50$ in the energy. I did prove $m=1$ is equivalent to other published forms, but haven't found anything in the literature about $m=2$, and think that the proving will take more time, effort, and insight (?). For applications, we just race ahead without worrying too much, but do check with standard, known expansions:

EK50 = Normal@ Series[D[ Expand[CES50^2/2] /.  Q^n_ :> (1/2)^n Binomial[n, n/2], \[Alpha]], {\[Alpha], 0, 50}];
SameQ[Normal@  Series[(2/Pi) EllipticK[\[Alpha]], {\[Alpha], 0, 50}], EK50]
Plot[{(2/Pi) EllipticK[\[Alpha]], EK50}, {\[Alpha], .9, 1}, ImageSize -> 500]
Out[]:= True

Approximation Validity

This plot gives an idea of approximation validity via the time integral over $2\pi$ radians in phase space. Essentially, even the time converges up to, say, $\alpha = 0.92$. Most of the divergence is tied up in the critical point, which is difficult to notice in the phase space drawings above.

Also compare the time of function evaluation:

tDIY = Mean[ AbsoluteTiming[Fast50[.9, RandomReal[{0, 1}]] ][[1]] & /@ Range[10000]];
tMma = Mean[AbsoluteTiming[JacobiSN[.9, RandomReal[{0, 1}]] ][[1]] & /@ Range[10000]];
tMma/tDIY

In the region of sufficient convergence, Mathematica function JacobiSN is almost 20 times slower. The CES radius also requires a function call to JacobiCN, so an output-equivalent AlienWavefunction algorithm using built-in Mathematica functions would probably take at least 20 times as long to produce. When computing hundreds of images this is a noticeable slow down, something to avoid ! !

Also compare time to evaluate the functional basis via the Bell Polynomials:

 BasisT2[n_] := Table[BellY[i, j, c /@ Range[2 n]]/(i!) Q^(i + 2 j), {i, 2, 2 n,  2}, {j, 1, i/2}];
SameQ[BasisT2[20], BasisT[20]]
t1 = AbsoluteTiming[BasisT[#];][[1]] & /@ Range[100];
t2 = AbsoluteTiming[BasisT2[#];][[1]] & /@ Range[25];
ListLinePlot[{t1, t2}, ImageSize -> 500]

Series Inverse

The graph shows quite clearly that careful evaluation via the recursion relations changes the complexity of the inversion algorithm to polynomial time, $(n^2)$, in one special example where the forward series expansions coefficients have known, numeric values.

Conclusion

We show proof-of-concept that alien logograms admit deformations that preserve the cycle topology. Furthermore we provide an example calculation where the "human" logogram couples to a surface. Deformation corresponds to scale transformation of the logogram along the surface. Each deformation associates with an energy.

Invoking the pendulum analogy gives the energy a physical meaning in terms of gravity, but we are not limited to classical examples alone. The idea extends to arbitrary surfaces in two, three or four dimensions, as long as the surfaces have local extrema. Around the extrema, there will exist cycle contours, which we can inscript with the Alien logograms. This procedure leads readily to large form compositions, especially if the surface has many extrema. Beyond Fourier methods, we might also apply spherical harmonics, and hyperspherical harmonics to get around the limitation of planarity.

The missing proof... Maybe later. LOL! ~ ~ ~ ~ Brad

And in the Fanfiction Voice:

Physicist : "It should be no surprise that heptapod speech mechanism involves an arbitrary deformation of the spacetime manifold."

Linguist : "Space-traveling aliens, yes, of course they know math and physics, but Buddhist symbology, where'd they learn that?"

POSTED BY: Brad Klee
Answer
7 days ago

Part 2 : Overlap & Fourier Analysis

Code available at: Github Branch .

Time-Independent Calculations

Taking each logogram as a two-dimensional wavefunction $$ | \Psi_n \rangle : \langle i,j | \Psi_n \rangle = \text{pixel data (normalized) }, $$ calculate overlap for each pair $M_{n,m} =M_{m,n} = \langle \Psi_n | \Psi_m \rangle $ :

overlaps

By row take the largest value other than $M_{n,n}=1$, and plot the superposition

superposition

Create wavefunctions

$$| \cos( n \phi ) \rangle: \langle i,j | \cos( n \phi ) \rangle = \cos(n \arctan(i,j)),$$ $$| \sin( n \phi ) \rangle: \langle i,j | \cos( n \phi ) \rangle = \sin(n \arctan(i,j)),$$

and use these to calculate the Fourier Amplitudes

$$FC_{n,m}=\langle \cos( n \phi ) | \Psi_m \rangle^2, $$ $$FS_{n,m}=\langle \sin( n \phi ) | \Psi_m \rangle^2, $$

Sum to obtain the total squared amplitude

$F_{m,n} = FC_{m,n}+FS_{m,n} $

For each wavefunction index by $m$, list plot the $n$ sequence. Also plot the most symmetric graphs.

Fourier Analysis I

more fanfiction:

Scientist: One plus one plus one, equals three. Three spatial dimensions, represented by approximate cyclic symmetry.

Linguist: Time goes around the circle. Clockwise or counterclockwise, endlessly repeating.

Scientist: Minus $d\tau^2$ equals $ds^2$. Surely the Aliens have some conception of special relativity. Logogram number 22, I'm starting to think that "spacetime" is a better translation than "time".

Linguist: The three lobes bear some resemblance to the partials for "suffering", "liberation". This third one, I don't know, looks like "stillness", possibly "death".

POSTED BY: Brad Klee
Answer
4 days ago

Part 3: Time Dependent Fourier Analysis

Again, notebook available at: Time Dependence .

Building on the Part 1 code above, we also expand the phase-space angular velocity $\dot{\phi}$ to $50$ powers of $\alpha$, the dimensionless energy. This is possible in relatively short time because $\dot{\phi}$ expands in powers of the phase space radius, which compute quickly enough, say, less than $5(s)$ to $r^{100}$. A good-enough function for $\dot{\phi}$ allows iteration of time evolution, drawing of animations, and time-dependent Fourier analysis.

H[n_, rep_] :=  ReplaceRepeated[(1/2) q^2 + (1/2) p^2 +   
 Total[(1/2) c[2 #]/((2 #)!) (q)^(2 + 2 #) & /@ Range[n]], rep]

\[Phi]Dot[n_, rep_] :=  ReplaceRepeated[  Divide[-Expand[D[H[n, {}], p] p + D[H[n, {}], q] q], p^2 + q^2], rep]

CES50Squared = Expand[Normal@Series[CES50^2, {\[Alpha], 0, 50}]];
Clear@Pow\[CapitalPsi];
Pow\[CapitalPsi][0] = 1;
Pow\[CapitalPsi][n_] := 
 Pow\[CapitalPsi][n] = 
  Expand[Normal@
    Series[Pow\[CapitalPsi][n - 2]*CES50Squared, {\[Alpha], 0, 50}]]

AbsoluteTiming[Pow\[CapitalPsi][100];]

Expand[
 H[50, {p^2 -> \[CapitalPsi]^2 - q^2, 
    q -> \[CapitalPsi] Q}] /. {Power[\[CapitalPsi], n_] :> 
    Pow\[CapitalPsi][n]}]

 \[Alpha]

AbsoluteTiming[  \[Phi]Dot50 =    Expand[Expand[\[Phi]Dot[  50, {p^2 -> \[CapitalPsi]^2 - q^2, 
        q -> \[CapitalPsi] Q}]] /. {Power[\[CapitalPsi], n_] :>  Pow\[CapitalPsi][n]}]; ]

FastCES50 = Compile[{{\[Alpha], _Real}, {Q, _Real}}, Evaluate@CES50];
Fast\[Phi]Dot50 = Compile[{{\[Alpha], _Real}, {Q, _Real}}, Evaluate@\[Phi]Dot50];

 AbsoluteTiming[Fast\[Phi]Dot50[.1, .5]]
 AbsoluteTiming[FastCES50[.9, 0]]

TestPeriod = Show[  ListLinePlot@
   NestList[# + Fast\[Phi]Dot50[.9, Cos[#]] (.1) &, 0, 
    Floor[2 Pi 2/Pi EllipticK[.9] 10]],
  Plot[N[-Pi], {x, 0, 2000}]
  ];

Also notice, evaluating this code, there exists a function $H(\Psi)$, the pendulum Hamiltonian, such that the CES, $\Psi(\alpha)$ here, satisfies the composition constraint $H(\Psi(\alpha))=\alpha$.

The Animations

Starting at time $t_0$, evolve each point in the ensemble according to $\phi_{n+1} = \phi_{n} + dt\;\dot{\phi}$, with $dt$ a small time step.

Time Evolution

Recall that the period of motion depends on the CES or equivalently on energy parameter $\alpha$. At a later time the ensemble smears out, as with "Arnold's cat" .

Time evolution

After a long enough time, the alien "logograms" look even more suspiciously like the older "Enso" diagrams. As in M.S. Child's Semiclassical Mechanics, Fig. 8.4 , we project the ensemble onto the $q$ axis to obtain $|\Psi(q)\rangle$. For $t_0$:

QWave1

After some time

QWave2

After $5000$ time steps, plot the autocorrelation function $\langle \Psi(q,t=0) | \Psi(q,t) \rangle $

Autocorrelation

which gives a useful metric for the smearing behavior seen above. Furthermore the autocorrelation signal shows periodicity as expected. This leads to a Fourier analysis for time-frequency. We partition the autocorrelation function into parts of length $T=\frac{2\pi}{\omega}$, and compute the amplitudes by taking all possible dot products

FourierMetric[data_, n_] :=  With[{dat = Normalize /@ Partition[data - Mean[data], n]},
  Mean@Flatten[ Table[Dot[dat[[i]], dat[[j]]], {i, 1, Length[dat]}, {j, 1, i}]]]

Time Fourier

What a cool hacker graph! Beneath the Fourier spectrum, we show overlap between the parts of the autocorrelation function. In the spectrum above, the solid lines are odd multiples of $\frac{\omega}{2}$, the quantum harmonic oscillator expectations. There's an overtone at $\frac{3}{2} \omega$, as expected considering the symmetry of the "Time" logogram. The best part of this code is how messy the spectrum looks. It's not necessarily better or worse than a lab measurement of Iodine. The lab data could be considerably worse if you don't have a feel for how the diffraction slit works.

POSTED BY: Brad Klee
Answer
4 days ago

Part 4: Constructing a Heptapod Sentence

In the following code we construct the Heptapod sentence for:

Painted Surface

"Teach all humans to solve time."

For complete code see: Plaintext, Notebook .

We assume the Gyroid surface appropriate for the sentence grammar, and approximate the geometric structure via the usual implicit equation

$$\sin(x + \pi/2) \cos(y + \pi/2) + \sin(y + \pi/2) \cos(z + \pi/2) + \sin(z + \pi/2) \cos(x + \pi/2)=0.$$

At the so-called monkey-saddle points, the surface expands naturally in cylindrical coordinates, with the $z$-axis along the surface normal. Applying series inversion to solve for $z(r,\theta)$ obtains a trigonometric function that coordinatizes a local patch of the surface. Even under modest series truncation, the patch combined with global, periodic structure provides an adequate cover of the entire surface. These equations allow construction of arbitrarily large alien texts, simply by mapping the logograms onto the surface contours.

ApproxGyroid =   Sin[x + Pi/2] Cos[y + Pi/2] + Sin[y + Pi/2] Cos[z + Pi/2] + Sin[z + Pi/2] Cos[x + Pi/2];
normal[mno_] := {
  If[OddQ[mno[[3]]], -1, 1],
  If[OddQ[mno[[1]]], -1, 1],
  If[OddQ[mno[[2]]], -1, 1]
  }

dualNormal[mno_] := {
  If[OddQ[mno[[2]]], -1, 1],
  If[OddQ[mno[[3]]], -1, 1],
  If[OddQ[mno[[1]]], -1, 1]
  }

xyz[mno_] :=  Plus[Times[mno, {Pi, Pi, Pi}], {Pi/2, Pi/2, Pi/2}]

Contour[mno_] :=  Plus[RotationMatrix[{{0, 0, 1}, normal[mno]}].{r Cos[\[Phi]], r Sin[\[Phi]],
    Normal[      InverseSeries[ Series[ApproxGyroid /. {x -> x + xyz[mno][[1]], 
            y -> y + xyz[mno][[2]], z -> z + xyz[mno][[3]]} /. 
          MapThread[Rule,  {{x, y, z}, 
            RotationMatrix[{{0, 0, 1}, normal[mno]}].{x, y, 
              z}}] /. {x -> r Cos[\[Phi]], y -> r Sin[\[Phi]]}, {z, 0,
          4}], y]] /. y -> 0}, xyz[mno] ]

DualContour[mno_] :=  Plus[RotationMatrix[{{0, 0, 1}, dualNormal[mno]}].{r Cos[\[Phi]], 
    r Sin[\[Phi]], Normal[InverseSeries[Series[
        ApproxGyroid /. {x -> x + Pi/2 + xyz[mno][[1]], 
            y -> y + Pi/2 + xyz[mno][[2]], 
            z -> z + Pi/2 + xyz[mno][[3]]} /. MapThread[Rule,
           {{x, y, z}, 
            RotationMatrix[{{0, 0, 1}, dualNormal[mno]}].{x, y, 
              z}}] /. {x -> r Cos[\[Phi]], y -> r Sin[\[Phi]]}, {z, 0,
          4}], y]] /. y -> 0},  xyz[mno] + {Pi/2, Pi/2, Pi/2}]

 AbsoluteTiming[ ContoursF = TrigReduce[  Normal@Series[ Contour /@ Tuples[{0, 1}, 3], {r, 0, 7}]];
 DualContoursF =   TrigReduce[   Normal@Series[      DualContour /@ Join[IdentityMatrix[3], -IdentityMatrix[3]],
 {r,  0, 7}]]; (* About 80(s) for me *)

 CentralDualContour = TrigReduce[Normal@Series[DualContour[{0, 0, 0}], {r, 0, 7}]];]

equation

Notice that the powers $r^n$ higher than $n=1$, the perturbative terms, all attach to $2\pi/3$ periodic functions. Compare this with earlier Fourier analysis, which characterizes the obvious symmetry of the Time symbol itself. Compare with the standard Mathematica Drawing

g0 = ContourPlot3D[
   ApproxGyroid == 0, {x, 0, 2 Pi}, {y, 0, 2 Pi}, {z, 0, 2 Pi}, 
   Mesh -> 3, ContourStyle -> Directive[Blue, Opacity[0.5]], 
   Boxed -> False, Axes -> False];

ContourDrawing = Show[g0,
  ParametricPlot3D[  Evaluate[(ContoursF /. r -> #/4)], {\[Phi], 0, 2 Pi}, 
     PlotStyle -> Directive[Thick, Blend[{Yellow, Green}, 2/3]]] & /@ 
   Range[7],  ParametricPlot3D[
     Evaluate[(DualContoursF /. r -> #/4)], {\[Phi], 0, 2 Pi}, 
     PlotStyle -> Directive[Thick, Darker@Blue]] & /@ Range[7],
  ParametricPlot3D[
     Evaluate[(CentralDualContour /. r -> #/4)], {\[Phi], 0, 2 Pi}, 
     PlotStyle -> Directive[Thick, Darker@Cyan]] & /@ Range[7], 
PlotRange -> All, Boxed -> False, Axes -> False, ImageSize -> 800  ]

surface

With a little more effort, we produce the following DIY drawing:

Contour Rotation

which shows the various patches overlapping sufficiently along all boundaries. This contour graph is essentially hand-writing paper that helps to align the alien logograms. In this particular sentence, Earth occupies a central position, and is surrounded by "time" repeated on 8 locations. While the symbols for "human", "humanity", "solve", "solve on you now", "use marker write", "there is no linear time" occupy the remaining six locations on the dual lattice.

More Fanfiction ( The Fight )

Linguist: Is this impermanence between us nothing more than a time ratio to you?

Scientist: A time ratio, yes. One person's lifetime, to the duration of a spoken lie, to all your social time. Unless blame outlasts, say, the galactic lifetime, I don't care !

Linguist: What about family time? You're willing to loose a wife because you need perfect ordering to work? A marriage isn't a monastery, get over it!

POSTED BY: Brad Klee
Answer
20 hours ago

Thanks for sharing, very elaborate and nicely visualised!

POSTED BY: Sander Huisman
Answer
15 hours ago

Group Abstract Group Abstract