Sunday 19 November 2017

Spacetime tells matter how to move, matter tells spacetime how to curve.

"Beyond the corridor of our spacetime there are infinite number of universes, each of them governed by their own set of laws."
Not general relativity, maybe next time if my computer has enough memory and time for that.

That's all Folks!
% ffmpeg -r 30 -f image2 -i %04d.png -ss 00:00:5 -vcodec libx264 -crf 2 output.mp4
clear all; close all; map = parula(256);
N    = 256;
phi  = zeros(N, N);
dphi = zeros(N, N);
ddphi= zeros(N, N);
rho  = zeros(N, N);
[x y] = meshgrid(linspace(-1, 1, N));
f = 0;
for t = 1:3*N
    A = 0.05;
    if t>N
        f = 0.01;
    end
    x1 = cos(2*pi*f*t)*A;
    y1 = sin(2*pi*f*t)*A;
    x2 = -cos(2*pi*f*t)*A;
    y2 = -sin(2*pi*f*t)*A;
    rho = exp(-2000*((x+x1).^2+(y+y1).^2)) + exp(-2000*((x+x2).^2+(y+y2).^2));

    ddphi = rho + del2(phi);
    dphi = dphi + ddphi;
    
     phi(1, :)   =   phi(2, :);
    dphi(1, :)   = -dphi(2, :);
     phi(end, :) =   phi(end-1, :);
    dphi(end, :) = -dphi(end-1, :);
     phi(:, 1)   =   phi(:, 2);
    dphi(:, 1)   = -dphi(:, 2);
     phi(:, end) =   phi(:, end-1);
    dphi(:, end) = -dphi(:, end-1);

    phi = phi + dphi;
    
    cla;
    c = phi/max(max(phi));
    surface(c, 'edgecolor', 'none');
    colormap(map);
    caxis([0 1]);
    axis([1 N 1 N]);
    axis square;
    axis off;
    shading interp;
    drawnow;
    imwrite(c*255, map, ['png/' num2str(t, '%04.f') '.png']);
end

No comments:

Post a Comment