Maths is smART |
Maths is smart, maths is art.
|
Here is the last of the star fractals followed by the Matlab code. If you have any questions about the code please ask.






function A = starsfractal(itterations, N, d, x_center, y_center, radius, direction, null_pt)
hold on
start = (N-2)*pi/(2*N) + mod(N,2)*direction*pi/N;
t = linspace(start,start+2*pi,N+1);
t(N+1)=[];
x = radius*cos(t);
y = radius*sin(t);
for i=1:N
X = [];
Y = [];
for j=1:N+1
X = [X x(mod(i+j*d,N)+1)];
Y = [Y y(mod(i+j*d,N)+1)];
end
set(gca, ‘ColorOrder’, [0.2 0.4 0.3]);
plot(X + x_center,Y + y_center)
end
if itterations ~= 1
star_pos = 1:N;
if null_pt ~= 0
star_pos(null_pt) = [];
end
for i=star_pos
j = mod(i+floor(N/2)+direction*mod(N,2),N);
if j == 0
j = j+N;
end
starsfractal(itterations - 1, N,d,4*x(i)/3 + x_center, 4*y(i)/3 + y_center, radius/3, mod(direction + 1,2),j);
end
end
There are so many inputs because of the recursive construction of the fractals. The only things you need to worry about is itterations, N and d. You should set the other values as default:
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.
Yesterday, I posted a picture using maths that looked like an owl. Now, maths is full of surprises… when typing in the code I wasn’t quite sure what I would get and I was quite pleased to see what had been created. Here are a few accidental animals:
Canary

Fish

…maybe they are quite vague, what do you think?
I hope you like my owl, I will be posting more pictures like this…
points=linspace(0,2*pi,100);
clf
hold on
for i = points
X = [];
Y = [];
t=linspace(0,2*pi,100);
x = cos(i)+cos(t);
y = sin(i)+sin(t).^2;
set(gca, ‘ColorOrder’, [139 69 19]./255);
plot(x,y)
end
hold off