Essays/Base Spectrum

From J Wiki
Jump to: navigation, search

Base Spectrum is a working code name for a density plot of a base representation of a number or a sequence of numbers.

Base 2 spectrum may be called binary spectrum, e.g.

Binary spectrum of the natural sequence:

   require 'viewmat trig plot'

   viewmat |: #:i.128

Natural.png

Sierpinski Triangle fractal (, ,.~)^:n ,1 is also a Binary Spectrum of the Sloane's A001317

It is defined as "Pascal's triangle mod 2 converted to decimal"

   #. |.2|!/~i.16
1 3 5 15 17 51 85 255 257 771 1285 3855 4369 13107 21845 65535

and can be obtained by recursive formula a(n+1) = a(n) XOR 2a(n)

   viewmat #:(~:/&.#:@, +:)^:(<32) 1

Sierpinksi.png

Other binary spectra:

   viewmat |: #: *: i.128         NB. squares

Square.png

   viewmat |: #: %: i.128         NB. square roots

Sqrt.png

   viewmat |: #: 2^. 1+i.128      NB. log2 x

Log2.png

   viewmat |: #:  ^. 1+i.128      NB. ln x

Ln.png

   viewmat |: #: ^ 1r32*i.128     NB. exp x

Exp.png

   viewmat |: #: cosh 1r32*i:128  NB. cosh x

Cosh.png

   viewmat |: #: sinh 1r32*i:128  NB. sinh x

Sinh.png

   viewmat |: #: tan 1r16*i.128   NB. tan x

Tan.png

Base 3 spectrum may be called ternary spectrum.

Here is some derivations of ternary spectrum of the natural sequence.

   viewmat +./\|:1=(6#3)#:i.3^6   NB. Cantor comb

Cantor-comb.png

   viewmat +/\|:1=(6#3)#:i.3^6   NB. Cantor city

Cantor-city.png

Same in 3D:

   'wire;boxed 0;viewpoint 2 _1 1.2'plot +/\|:1=(6#3)#:i.3^6

Cantor-3d.png

See Also


Contributed by Oleg Kobchenko.