Maths is smART |
Maths is smart, maths is art.
|
Rainbow
This was actually quite a challenge to do, I had to create a colour matrix that created a gradual change to each colour in the rainbow. Here is the code:
clf
hold on
n = 140;
ColourMatrix = zeros(n+2,3);
for i=1:n/7
ColourMatrix(i,:) = [255 153*7*i/n 0]./255;
ColourMatrix(i+n/7,:) = [255 (255-153)*7*i/n+153 0]./255;
ColourMatrix(i+2*n/7,:) = [-255*7*i/n+255 255 0]./255;
ColourMatrix(i+3*n/7,:) = [-255*7*i/n+255 -255*7*i/n+255 255*7*i/n]./255;
ColourMatrix(i+4*n/7,:) = [0 65*7*i/n (106-255)*7*i/n+255]./255;
ColourMatrix(i+5*n/7,:) = [143*7*i/n -65*7*i/n+65 (255-106)*7*i/n+106]./255;
ColourMatrix(i+6*n/7,:) = [(255-143)*7*i/n+143 255*i/n 255]./255;
end
t = linspace(0,pi,n);
for r=linspace(5,6,n)
x = (11-r)*cos(t);
y = (11-r)*sin(t);
set(gca, ‘ColorOrder’, ColourMatrix(floor((r-5)*n+1),:));
plot(x,y)
end
hold off
I hope I explain well enough, if you ever want to ask me something you can email me on mathsissmart@gmail.com
I generated Brownian motion in one dimension and changed the colour matrix to obtain different textures. Here are some of the results:




Hey guys! I would like to thank you again for all the support you have showed me. I know this is still a very small blog but I am proud of the interest that I have gotten so far. I have just been posted on the website http://coolmathguy.com/ which is a big deal for me as I have been visiting this website regularly for a while now. You can find the post at the following link: http://coolmathguy.com/little-math-art-tumblr
Now I just wanted to show you one more picture I created using the code from “Around and around” which I posted yesterday. Am sorry for the it being too repeatitive but I promise something more interesting coming soon! Thanks again :)

Some more pictures using the code that I posted yesterday.


And the following one which is my favourite:

Thank you all for the support and encouragement :)
About a week ago I blogged about randomness and one of the pictures I posted looked like this:

This was created using the following code:
nopoints = 20;
x = linspace(-1,1,nopoints);
dt = 0.005;
n = 1/dt;
theta = 2*pi*dt;
A = [cos(theta) -sin(theta); sin(theta) cos(theta)];
y = x;
clf
hold on
for i=1:n
for j=1:nopoints
v = [x(j);y(j)];
vnew = A*v;
x(j) = vnew(1);
y(j) = vnew(2);
end
set(gca, ‘ColorOrder’, rand(1,3));
plot(x+10,y+10)
end
hold off
Granted this is a bit complicated for the effected created but I wanted to change the 7th line to another function and just by that simple change create more interesting pictures. Well that is what I have done, and here are a few of the consequences:


I will post more tomorrow, including my favourite! For now, what function do you think I used for this picture:

I am going to be really busy for the next 2 weeks so won’t be able to post anything too amazing but I have some really exciting projects that I have had to put on hold. Anyways, here are a few cool pictures:



points=linspace(0,2*pi,200);
clf
hold on
for i = points
t=linspace(0,2*pi,100);
x = cos(i)+sin(t);
y = sin(i)+cos(t);
set(gca, ‘ColorOrder’, (rand(1,3)+1)./2);
plot(x,y)
end
x = 2*sin(t);
y = 2*cos(t);
set(gca, ‘ColorOrder’, [0 0 0]);
p = plot(x,y)
set(p,’Color’,’black’,’LineWidth’,2)
hold off
A simulation made in Matlab of 10 single realiations of a two-dimensional Wiener process.
I don’t know much about the history of this subject. All I know (or what I think I know) is that Robert Brown was a botanist who observed the random movement of pollen grains in water. The continuous and jerky movement of such a particle is what we describe as Brownian motion and the mathematical representation of this is called the Wiener process in honour of Norbert Wiener.
The cool thing about the Wiener process is that it is everywhere continuous but nowhere differentiable. Although a computer could never totally simulate brownian motion I like to create pictures using the idea of Brownian motion.
The trajectories of 10 particles in two dimensions starting from the origin:

clf
t = 2.0;
dt = 0.005;
n = floor(t/dt);
ntraj = 20;
T = linspace(0,2*pi,100);
circle_x = 10*sin(T)
circle_y =
x = zeros(ntraj,n+1);
y = zeros(ntraj,n+1);
tspan = [0:dt:t];
for i = 1:n
x(:,i+1) = x(:,i) + sqrt(dt)*randn(ntraj,1);
y(:,i+1) = y(:,i) + sqrt(dt)*randn(ntraj,1);
end
hold on
for i=1:ntraj
set(gca, ‘ColorOrder’, rand(1,3));
plot(x(i,:),y(i,:))
end
hold off
I will be posting an animation of 10 particles of a two dimension Wiener process.
Thought I would post this picture before I go to bed. I love how something which is two dimensional can look like it is three dimensional!