Sunday, 29 December 2013


Not much this time, but I wish to have this video here (on science and philosophy).

...also let's put some messages into big numbers...



n =


ans =



...decode code in octave (as opposed to matlab)...

r1 = javaObject('java.math.BigInteger', '1272217067541950449850037473')
r2 = javaMethod('toString', r1, 2)
r3 = char(r2)
r4 = vec2mat(r3, 7)
r5 = bin2dec(r4)
r6 = transpose(r5)
r7 = char(r6)

r7 = Abibliophobia


a = javaObject('java.math.BigInteger', '1272217067541950449850037473')
b = javaMethod('toString', a, 2)
char(bin2dec(reshape(b, 7, length(b)/7)')')


Sunday, 22 December 2013

Though you are not sentient and do not comprehend, I nonetheless consider you a true and valued friend.

...some quick notes, mostly for myself. I've been calculating massive amounts of cross correlation at work recently and the CPU-time needed for that is significant so I was looking into using the GPU instead. I found that GeForce GTX 670 does what I need about 5 times faster than i7-2600K (though utilization of the cores was poor in this code, but nice finger exercise none the less).

Small update: I managed to get a speedup of more than 8-10 using GPU with large number of repetitions.
More update: Using single precision floating point operations gives 2x 240 MS/s with the GPU.

% This program compares the difference in speed between calculating
% a cross correlation of 2x8 MS vectors using CPU and GPU
% on i7-2600K @ 3.4 GHz with 8 GB of RAM vs. GeForce GTX 670 
% the speedup is around 4.9, cross correlation can be efficiently 
% calculated through the use of fast fourier transform.
% If only cross-spectrum is of interest then inverse fft is
% unnecessary and some time can be saved.

clear all;
a = randn(2^23, 1);
b = randn(2^23, 1);

A = fft(a);
B = fft(b);
C = ifft(times(conj(A), B), 'symmetric'); % xcorr of CH1 and CH2
aa = dot(a, a); % zero delay autocorr of CH1
bb = dot(b, b); % zero delay autocorr of CH2
timecpu = toc

a = gpuArray(a);
b = gpuArray(b);
A = fft(a);
B = fft(b);
C = ifft(times(conj(A), B), 'symmetric');
aa = dot(a, a);
bb = dot(b, b);
C = gather(C);
aa = gather(aa);
bb = gather(bb);
timegpu = toc

speed = timecpu/timegpu


n1 = randn(2^N, 1);
n2 = randn(2^N, 1);
for z=1:n
    a = gpuArray(n1);
    b = gpuArray(n2);
    A = fft(a);
    B = fft(b);
    C = ifft(times(conj(A), B), 'symmetric');
    C = gather(C); % if you don't gather -> 96 MSPS (x2)
timegpu = toc
speed = n*2^N/timegpu/1e6

timegpu =


speed =


2x 75 MS/s, if you don't gather (for example just average on the GPU) 2x 96 MS/s, 2x240 MS/s with single precision floating point instructions ... randn(2^N, 1, 'single').


Intel Core i7-2600K (4x 3.4 GHz)
GeForce GTX 670 (1344 CUDA-cores, 915 MHz, 6 GHz memory)

Averaging performance including data transfer overheads :

CPU single precision dot-product (1-point xcorr) 2x 600 MS/s
CPU double precision dot-product (1-point xcorr) 2x 300 MS/s
CPU single precision cross-correlation 2x  23 MS/s
CPU double precision cross-correlation 2x  13 MS/s

GPU single precision dot-product (1-point xcorr) 2x 433 MS/s
GPU double precision dot-product (1-point xcorr) 2x 227 MS/s
GPU single precision cross-correlation 2x 225 MS/s
GPU double precision cross-correlation 2x  90 MS/s


In the spirit of the Hobbit...
Some fiddling with matlab again. I wasn't aware that java could be integrated this way into matlab, but nice to know...

% Simple RSA cryptosystem testing in matlab

one = java.math.BigInteger.ONE;
p = one.probablePrime(256, java.util.Random);
q = one.probablePrime(256, java.util.Random);

n = p.multiply(q); % first part of the public key (n, e)
tmp0 = p.subtract(one);
tmp1 = q.subtract(one);
totient = tmp0.multiply(tmp1);
tmp0 = java.math.BigInteger('2');
tmp1 = totient.divide(tmp0);
e = tmp1.nextProbablePrime(); % second part of the public key (n, e)
d = e.modInverse(totient); % the private key

m = java.math.BigInteger('123321243425345'); % message

c = m.modPow(e, n) % encryption
m = c.modPow(d, n) % decryption


% Fermat primality test

one = java.math.BigInteger.ONE;
p = java.math.BigInteger('221');
n = p.subtract(java.math.BigInteger.ONE);

a = one.nextProbablePrime();
a.modPow(n, p) % a^n mod p

a = a.nextProbablePrime();
a.modPow(n, p) % this needs to be always one if p is prime
% ...


Efficient modpow algorithm for large numbers...

a = java.math.BigInteger('2988348162058574136915891421498819466320163312926952423791023078876139');
b = java.math.BigInteger('2351399303373464486466122544523690094744975233415544072992656881240319');
m = java.math.BigInteger('87814412832655818143772433337418883492663173730772486450699007318453048545183');

ZERO = java.math.BigInteger.ZERO;
ONE = java.math.BigInteger.ONE;
s = ONE;
t = a;
u = b;

while u.equals(ZERO) == 0
    if u.and(ONE).equals(ONE) == 1
        s = s.multiply(t).mod(m);
    u = u.shiftRight(1)
    t = t.multiply(t).mod(m);

a.modPow(b, m)

Monday, 16 December 2013

When a man cannot choose, he ceases to be a man.

So, the hidden messages... basically single lines of code in matlab...

The first one you might recognize by the artifacts at the four corners of the image, they suggest that something funny is going on in the frequency space. In other words the classic way to find the hidden message is to perform a 2D fourier transform on the image. Perhaps the simplest way to reveal the message is to use a gimp plugin (for example G'MIC). You can also make these images using G'MIC and simply painting your hidden messages and then inverse transforming them. However, I did mine in matlab. In this case I transform the red color component.

pic1 = imread('d:\babel\20131215\me.jpg');
imagesc(log10(abs(fft2(pic1(:, :, 1)))), [0 5]);

The image suffers a little bit from jpg-compression, but no worries. The logarithmic scaling is unimportant, you see it just fine even with gimps default settings. You could use the same idea to encode messages into mp3s for example and they would be revealed in their spectrogram (4:10 is interesting in this video).

Perhaps the most famous was the face used by Aphex Twin at the end of one of their tracks (at 5:30).

Here's how I did my picture:

pic = imread('d:\babel\20131209\me.png');
MSG = imread('d:\babel\20131209\msg.png');
MSG = imresize(MSG, [406 640]);
R = fft2(pic(:, :, 1));
R = R + 15*double(MSG);
r = ifft2(R, 'symmetric');
pic(:, :, 1) = abs(r);
imwrite(pic, 'd:\babel\20131209\me.jpg', 'JPG');

You could do something similar even for a video.

The second image is a bit more interesting because no visible signs can be seen and it would be very difficult to recognize anything but noise even if you could compare it to the original unaltered image. Yet the method is fairly simple. The least significant bit of every pixel is part of 8-bit ASCII encoded message (notice how the image is encoded using a bit perfect PNG-compression unlike the first image).

pic2 = imread('d:\babel\20131215\cat.png');
sprintf(char(bin2dec(vec2mat(sprintf('%d', double(mod(pic2(1:1702*8), 2))), 8))))

ans =

You ask me...

Don't pay too much attention to the trickery in the code. There are numerous ways to do it all equally well. You could even encode the message into a lesser number of bits like 7 as ASCII is often encoded in or you could even make your own character sets or include further tricks, however I figured that doing so would make it unnecessarily hard. 

Through my living room window one early morning.
And here's the code to make the image with the message:

message = double('You ask me for a hamburger. My attempt to reciprocate is cut brutally short as my body experiences a sudden lack of electrons. Across a variety of hidden dimensions you are dismayed. John Lennon hands me an apple, but it slips through my fingers. I am reborn as an ocelot. You disapprove. A crack echoes through the universe in defiance of conventional physics as cosmological background noise shifts from randomness to a perfect A Flat. Children everywhere stop what they are doing and hum along in perfect pitch with the background radiation. Birds fall from the sky as the sun engulfs the earth. You hesitate momentarily before allowing yourself to assume the locus of all knowledge. Entropy crumbles as you peruse the information contained within the universe. A small library in Phoenix ceases to exist. You stumble under the weight of everythingness, Your mouth opens up to cry out, and collapses around your body before blinking you out of the spatial plane. You exist only within the fourth dimension. The fountainhead of all knowledge rolls along the ground and collides with a small dog. My head tastes sideways as spacetime is reestablished, you blink back into the corporeal world disoriented, only for me to hand you a hamburger as my body collapses under the strain of reconstitution. The universe has reasserted itself. A particular small dog is fed steak for the rest of its natural life. You die in a freak accident moments later, and you soul works at the returns desk for the Phoenix library. You disapprove. Your disapproval sends ripples through the inter-dimensional void between life and death. A small child begins to cry as he walks toward the stairway where his father stands.');

message_in_bin = dec2bin(message, 8);
A = imread('d:\babel\20131209\org_cat.png');
ss = size(message_in_bin);
message = message_in_bin';
for x = 1:ss(1)*ss(2)
    value = bin2dec(message(x));
    if mod(A(x), 2) ~= value
        if A(x) > 100
            A(x) = A(x) - 1;
            A(x) = A(x) + 1;
imwrite(A, 'd:\babel\20131209\cat.png', 'PNG');

Monday, 9 December 2013

Nothing is easy, nothing is pure. Yet we must go on.

“You will be required to do wrong no matter where you go. It is the basic condition of life, to be required to violate your own identity. At some time, every creature which lives must do so. It is the ultimate shadow, the defeat of creation; this is the curse at work, the curse that feeds on all life. Everywhere in the universe.”
...Do Androids Dream of Electric Sheep?

The two pictures above have hidden messages. Can you find them? It's not hard at all, but without a bit of background it might be tricky. In fact, I believe many of my readers have the necessary background in principle, but will anyone do it?-) And for some, even the time would be right. I'll even give you useless hints, Disney has something to do with the first one and the second one is a story. Matlab helps.

Functions are just names for algorithms which paint a map and sometimes (if not always) two different functions paint maps of the same object, only with a slight twist.

Fucking magnets, How do they work? ...quite simple in fact.

Perhaps I want nothing. Perhaps I just wanted to know what you thought about it.

At least 5e120 calculations have been performed by the universe since the big bang. About 100 billion humans have walked on this planet since the beginning of time. The number of multiverses has been estimated to be around 10^(1e16).

Monday, 25 November 2013

Guess, Spock. Your best guess.

Spock: Guessing is not in my nature, Doctor.
McCoy: Well... nobody's perfect.
Q: Do you think everything can be explained and will be explained?
A: Yes, though it depends what you mean by explain. I believe the Universe is everything and the only comprehensive explanation of the Universe is the Universe itself. However, explanation (the way I've learned that word) does not imply omniscience. Explanation is a model, an approximation of the whole, a valid generalization within certain (error) limits, something which attemps to converge towards the correct answer. Infinitely approach it, but never quite reach it. I believe we can make "the best guess" based on finite amount of information we've fed into the model, a guess we can be proud of, a guess which doesn't warrant regret even if we find points which won't fit. If that occurs, we'll just make a better guess, a more sophisticated guess, an educated guess.
We will never be right about anything, it's like trying to model a fractal by fitting polynomials into it. It is infinitely complex from the context of the polynomial, but is still something we can understand an approximate. Kind of like some peoples worldviews, I find it odd people get so upset when their worldviews are proven wrong, they should expect it, embrace it. The world does not flow along a smooth line you can draw on a map, you can never be sure your worldview is converging towards the global minimum (but that's why we need noise), and thank goodness for that, we'd be bored to death in no time at all if that was the case.

No matter how good you become, you'll never beat Moore's law, but even if you did, you'd still be stuck on this planet, in this solar system, this galaxy and this universe. How far is far enough?

Looking into building small executables (for anything) and possibly a small os and compiler for the raspberry pi...

; nasm -f bin elf_x86.asm

                org     0x08048000

  ehdr:                                                 ; Elf32_Ehdr
                db      0x7F, "ELF", 1, 1, 1, 0         ;   e_ident
        times 8 db      0
                dw      2                               ;   e_type
                dw      3                               ;   e_machine
                dd      1                               ;   e_version
                dd      _start                          ;   e_entry
                dd      phdr - $$                       ;   e_phoff
                dd      0                               ;   e_shoff
                dd      0                               ;   e_flags
                dw      ehdrsize                        ;   e_ehsize
                dw      phdrsize                        ;   e_phentsize
                dw      1                               ;   e_phnum
                dw      0                               ;   e_shentsize
                dw      0                               ;   e_shnum
                dw      0                               ;   e_shstrndx

  ehdrsize      equ     $ - ehdr

  phdr:                                                 ; Elf32_Phdr
                dd      1                               ;   p_type
                dd      0                               ;   p_offset
                dd      $$                              ;   p_vaddr
                dd      $$                              ;   p_paddr
                dd      filesize                        ;   p_filesz
                dd      filesize                        ;   p_memsz
                dd      5                               ;   p_flags
                dd      0x1000                          ;   p_align

  phdrsize      equ     $ - phdr

                mov     eax, 4                          ; syscall 4: write
                mov     ebx, 1                          ; stdout
                mov     ecx, msg                        ; message address
                mov     edx, 13                         ; number of bytes
                int     0x80                            ; invoke syscall

                mov     eax, 1                          ; syscall 1: exit
                xor     ebx, ebx                        ; return code 0
                int     0x80                            ; invoke syscall

  msg:          db      'hello, world',10,13            ; also \n

  filesize      equ     $ - $$
decod@korpimaa:~/tiny$ nasm -f bin elf_x86.asm
decod@korpimaa:~/tiny$ ls -l elf_x86
-rwxrwxr-x 1 decod decod 129 Nov 11 19:45 elf_x86
decod@korpimaa:~/tiny$ ./elf_x86
hello, world

/*  x64 asm */
#define write(message, length) \
asm ( \
"mov $1, %%rax;" \
"mov $1, %%rdi;" \
"mov %0, %%rsi;" \
"mov %1, %%rdx;" \
"syscall" \
:: "r" (&message), "g" (length) \
: "rax", "rdi", "rsi", "rdx")

#define exit() \
asm ( \
"mov $60, %rax;" \
"mov $0, %rdi;" \

_start() {
        char str[] = "Hello, World\n";

        write(str, 13);
decod@korpimaa:~/tiny$ gcc -nostdlib hello_x86.c

decod@korpimaa:~/tiny$ strip a.out
decod@korpimaa:~/tiny$ ./a.out
Hello, World
decod@korpimaa:~/tiny$ ls -lah a.out
-rwxrwxr-x 1 decod decod 1.1K Nov 11 19:48 a.out

decod@korpimaa:~/tiny$ objcopy a.out -O binary
decod@korpimaa:~/tiny$ ls -lah a.out
-rwxrwxr-x 1 decod decod 192 Nov 11 19:49 a.out

#define write(msg) asm volatile ( \
"mov r0, $1;" \
"mov r1, %0;" \
"mov r2, $13;" \
"mov r7, $4;" \
"swi $0" \
:: "r" (msg) \
: "r0", "r1", "r2", "r7")

#define exit() asm ( \
"mov r0, $0;" \
"mov r7, $1;" \
"swi $0")

_start() {
        char str[] = "Hello, World\n";

pi@raspberrypi ~ $ gcc helloarm.c -nostdlib

pi@raspberrypi ~ $ strip a.out
pi@raspberrypi ~ $ ls -lah a.out
-rwxr-xr-x 1 pi pi 720 Nov 11 17:50 a.out

pi@raspberrypi ~ $ objcopy a.out -O binary
pi@raspberrypi ~ $ ls -lah a.out
-rwxr-xr-x 1 pi pi 140 Nov 11 17:50 a.out

ubuntu@ubuntu:~$ wget
ubuntu@ubuntu:~$ gcc -m32 otccelf.c
ubuntu@ubuntu:~$ ./a.out otccelf.c otccelf1
ubuntu@ubuntu:~$ chmod +x otccelf1
ubuntu@ubuntu:~$ ./otccelf1
usage: otccelf file.c outfile

ubuntu@ubuntu:~$ wget
ubuntu@ubuntu:~$ wget
ubuntu@ubuntu:~$ gcc -m32 otccelfn.c
ubuntu@ubuntu:~$ ./a.out otccex.c otccex
ubuntu@ubuntu:~$ chmod a+x otccex
ubuntu@ubuntu:~$ ./otccex
usage: ./otccex n [base]
Compute fib(n) and fact(n) and output the result in base 'base'

Something to aim for...



Some old effects...

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL/SDL.h>

int WinMain() {
SDL_Event event;
SDL_Surface *screen, *textureImg;
int quit = 0, shiftX, shiftY, shiftLookX, shiftLookY;
float timeDisplacement = 0.0;
int *p, *q;
int x, y;
int *distanceTable=(int *)malloc(4*1024*1024);
int *angleTable=(int *)malloc(4*1024*1024);
int w=512, h=512;
int angle;
int depth;
int texture_x=0, texture_y=0;

textureImg = SDL_LoadBMP("red_smoke.bmp");
for(x=0; x<w*2; x++)
for(y=0; y<h*2; y++) {
depth = 32.0 * 512 / sqrt(1.0*((x - w) * (x - w) + (y - h) * (y - h)));
angle = 0.5 * 512 * atan2(1.0*(y - h), 1.0*(x - w)) / 3.141592653589793;
distanceTable[x+y*1024] = depth;
angleTable[x+y*1024] = angle;
screen = SDL_SetVideoMode(512, 512, 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
while(!quit) {
timeDisplacement += 0.015;
shiftX = 512 * .2 * timeDisplacement+300;
  shiftY = 512 * .15 * timeDisplacement+300;
shiftLookX = w / 2 + 0*w / 4 * sin(timeDisplacement);
shiftLookY = h / 2 + 0*h / 4 * sin(timeDisplacement * 1.5);
for(y=0; y<512; y++)
for(x=0; x<512; x++) {
texture_x = abs((distanceTable[ (x+shiftLookX) + (y+shiftLookY)*1024] + shiftX)) % 512;
texture_y = abs((angleTable[ (x+shiftLookX) + (y+shiftLookY)*1024] + shiftY)) % 512;
        q = (int *)textureImg->pixels+(texture_x+texture_y*511);
        p = (int *)screen->pixels+(x+y*512);
        *p = *q;
if(event.type==SDL_QUIT) quit = 1;
return 0;

You'd never let me win anyway...
...well, that wouldn't be winning.

Tuesday, 22 October 2013

Thinking meat! You're asking me to believe in thinking meat!

Blogspot keeps failing to format the text properly (on windows, mac and linux :-D)
I decided to fiddle with my fire-effect code (at the end of this blog entry) again, simplify it a bit and have it compile on MacOS.

Typically I've been against macs, but I'm rather enjoying this one (MacBook Air 11") so far, they've come a long way. The keyboard takes some getting used to, but I find the laptop rather elegant in many ways. I especially like the battery lifetime which seems to be around 8 hours if I don't do too much heavy lifting on it. It can play 1080p videos smoothly, doesn't need a fan and  can even do some 3D, and is small. Wakes up instantly and boots in 10 seconds or so. Even built in audio is decent for such a small package. The software is fast and responsive, the screen image quality nice, though I suppose FullHD would have been nice, but this is still quite sufficient for a laptop such as this.
I use tinycc on windows because it's just so small, elegant and simple, and handles libraries to my liking...

tcc winfire.c -lSDL -lopengl32

on mac I compile with gcc (I'm sure there's a better way, like Xcode, but I couldn't be bothered, I like to KeepItSimpleStupid):

gcc macfire.c -I/System/Library/Frameworks/OpenGL.framework/Headers -lSDL -lSDLmain -framework AppKit -framework Foundation -framework CoreFoundation -framework OpenGL

Yellow rose of texas (4k intro) seems to run fine on my MacBook Air 11" as well. A working binary wasn't available, but it's easy enough to compile your own.
I tried and but didn't seem to be able to compress it much, these are very small executables to begin with, but it seems tcc does something which these programs can't handle well. I suppose I should just write asm from the beginning, but it's just so bothersome. Maybe if I had plenty of time to fiddle. There's so much I'd like to do, like FTDT-simulator (, but just can't be bothered right now. Perhaps Aristotle was right, and all paid jobs absorb and degrade the mind. Perhaps I should simply do something mundane for a living and save all the really interesting jobs for my hobby.

In another news, I was playing with simplicity...
(Later addition:

I wish I could just get an operating system and hardware where I understand every single line of code it runs and there is almost zero redundancy. Like stripped down linux kernel (possibly on raspberry pi), running uClibc, tinycc, busybox, vim etc. without any autodetection and such. In fact I'm not sure even X-windows is needed. Just run everything from console and draw the graphics (like browser) on framebuffer in separate ALT+Fn:s (desktops or consoles or fullscreen windows or whatever you wish to call them) + hardware accelerated OpenGL of course. I really like the idea of a SoC ( If only the universe was full of stations (floating in space) which would provide all the bare essentials for the explorers and their space ships, food, gas and guns, and in practice all standard supplies, medicare and parts. :-D

...and why do we even needs wallets, cards, money, passports etc. these days. Should all this stuff be just software on our cellphones, laptops (or perhaps pads, which I don't believe in really).

There is some elegance in Linux as well, in fact quite a lot. All three Windows (7), Linux and MacOS have come a long way I have to say. They are finally getting mature. Though X on Linux is still insanely slow and there is annoying hardware and software incompatibility and immaturity issues in Linux still, but for homebrew, flexibility, control and servers it just rules. Linux kernel is rather nice already I should say, but X and some of the software it runs really needs some work. It still often can't manage even the simplest things like proper vsync  on videos which results in tearing.

I think I'll dump powerpoint for making presentation as well, LaTeX beamer seem to be nice enough and free for that stuff, I'll end up with cleaner outcome with it anyway, and I use LaTeX to write papers anyway so why bother with anything else. There are pretty much only a few commercial programs I really keep using, mainly Matlab and PhotoShop, both are more or less provided to me by the university. They can be replaced by octave and gimp, but neither are really as mature or pleasant to use as these. Additionally there is APLAC which I use for circuit simulation, there is Qucs, but it's again not quite as pleasant and can't do all the stuff APLAC can, perhaps with ngspice one could, but it's annoying and lacks a Josephson junction. If I really had to, I would just switch to Linux entirely. I still try to keep everything compatible even if I'm still waiting for better days. Mac is elegant and windows is diverse, but they are closed and commercial so they will eventually have to go. Then there is of course still minix, I haven't taken a look at that, but it might be a good place to start if I start writing my own kernel again one day. From windows alone I would miss this:

Good to see that every once in a while some good ideas take a step forwards...

Was playing some GTA V today.
24 fps just isn't good enough for movies these days anymore, the pans are jerky. The new 48 fps is much better, though the movie makers needs to adjust to it a little bit to make it look natural. 60 fps would be better, perhaps sufficient for all material. And 4K, such a nice resolution, I can't wait to get some material, nature documentaries, but then again, why bother buying 4K when there's 8K coming soon, perhaps that is finally enough for resolution. When I get dead silent (without fan) 8K projector with 60 fps capacity and 1000000:1 static ANSI contrast, not some crappy dynamic bullshit values like everything today which are actually more like 300:1 static ANSI, maybe with OLED, then perhaps I'm finally happy with my home theater. 3D? No way, hurts my head, feels unnatural. Maybe when they make the holodeck ( 3D isn't needed anyway, there's enough to be experienced in other ways. Not to mention someone investing in a decent plot instead of graphics and number crunching.

Though my audio system would require some improvements as well, it's pretty nice already, perhaps in some ways the biggest part of my system, but I'd prefer to go real loud real low. Now I can push maybe 130 dB(C) indoors respectably maybe at 30 Hz without distortion (4x15"), but what I would really like is to hit 140dB(C) outdoors to 10 meters or something at 20 Hz, well maybe for a concert at 35-40Hz would actually be sufficient. Perhaps impossible for my budget. Not the biggest problem though, bigger issue is that there are standing waves, frequency dependent constructive and destructive interference within the room. The whole room should be designed from the beginning to act as a horn or something to make decent acoustics and get rid of all this... this perhaps.

Why is it that nobody present the real specs for any of this equipment these days, none of the good stuff. It's almost impossible to find the ANSI contrast figures, black levels etc. for any TV or projector and finding the frequency response, harmonic distortion vs. SPL vs. frequency for speakers is equally nonexistent. This is easy stuff to measure and very important when making decisions about the quality of your stuff, but none of this just seems to be available basically anywhere - ever.

Oh well, something for the better days maybe.

All life occurs between order and chaos. No life can exist at the two extremes. Perhaps the best place to be is right in the middle of everything, a true neutral if you will.

Physically all information processing appears to occur through nonlinear processes which couple different modes together. Often through switches or amplifiers or something similar. One signal controls another, one way or another. All nontrivial evolution is non-adiabatic and entropy changes occur.
Yes, this photo is from my balcony as well.
If it is true that Pi has all possible finite sequences, and the universe is finite, then the entire universe is somewhere described in the digits of Pi. Talk about your compression algorithms.
...but is the zip-code any shorter than the universe it is pointing to?-)
(It is not known for sure that Pi has all possible finite sequences, it is believed to be that case however.)
#include <SDL/SDL.h> #include <stdio.h> #include <GL/gl.h> // <OpenGL/gl.h> on macos main() { SDL_Event event; SDL_Surface *surface; unsigned int texture; int x, y, i, j; unsigned char stage1[140*100], stage2[256*200], stage3[256*256*4]; SDL_Init(SDL_INIT_VIDEO); surface = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL|SDL_GL_DOUBLEBUFFER|SDL_HWSURFACE); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glEnable(GL_TEXTURE_2D); while(event.type!=SDL_QUIT) { SDL_PollEvent(&event);  for(x=1; x<140; x++)  stage1[140*99+x] = 255-rand()%100; for(y=48; y<100; y++) for(x=0; x<140; x++) { i = stage1[y*140+x]; j = x+(y-1)*140; if(i<16)  stage1[j] = 0;          else  stage1[j+rand()%2] = i-rand()%12;        } for(y=48; y<100; y++) for(x=0; x<140; x++) stage2[2*x+2*y*256] = stage1[x+y*140];  for(y=96; y<199; y++) for(x=1; x<255; x++) stage2[x+y*256] = (stage2[(x-1)+y*256]+stage2[x+(y-1)*256]+stage2[(x+1)+y*256]+stage2[x+(y+1)*256])>>2; for(y=0; y<97; y++) for(x=0; x<256; x++) stage3[4*x+4*y*256] = stage2[x+(y+103)*256]; glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, 4, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, stage3); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(-1.07, 1.07); glTexCoord2f(1, 0); glVertex2f(1.07, 1.07); glTexCoord2f(1, 1); glVertex2f(1.07, -4.5); glTexCoord2f(0, 1); glVertex2f(-1.07, -4.5); glEnd(); SDL_Delay(20); SDL_GL_SwapBuffers(); } SDL_Quit(); }