Greg Klein's Blog

Archive for the ‘math’ Category

T-Square Fractal Cubes

with one comment

If you don’t already know, I like fractals a lot.

A few months ago I was playing around with the T-Square fractal. Recently I decided to revisit this fractal and try to add another dimension. So instead of using squares, I decided that I’d use cubes and make the rules the same. For each free corner on a cube, create another cube and repeat.

So I wrote a small program in Python that creates a scene for Povray (speaking of which, I wasn’t able to find any good libraries for talking to Povray in Python! If anyone knows of such a library, I’d love to know.)

Anyway, here are the results:

T-Cube Fractal

T-Cube fractal iterated 9 deep

I’d love to make a video out of this but I don’t think my budget can afford it right now. The frame you see above you took about an hour or so to render on my laptop. Unless anyone has a cluster they’re willing to lend me, I’ll have to stick to stills for now.

Update 3/26/12:

I decided to 3d print it. Printed on a 3d powder printer at Makers Factory in Santa Cruz.

In order to get it made into a proper 3d file, I actually ended up writing a Python script for Blender, you can find that here. Turns out that scripting Blender is way easier than writing .STL files — just to write a cube you need to define a bunch of vertices’s and get them all in the right order or the normals are screwed up.

And a 3d print of the fractal with only 6 iterations this time.

Update (again) 4/16/12:

I sent away to Shapeways to get it printed in black plastic.

3d printed fractal from Shapeways

Written by gregklein

February 17, 2012 at 5:03 pm

Posted in fractal, math, python

Tagged with

Lasers, Smoke, and Ice

with 6 comments

Smoke is really interesting. It’s a gas, so it ends up being very chaotic, especially when turbulent.

I was playing with lasers the other day and had the idea to make two-dimensional a plane of laser light and project it through smoke, effectively visually ‘cutting’ the laser smoke into a slice that I could see. So I attached a mirror with a 45 degree tilt to a computer fan, pointed a 5mW green laser at it, and spun it up.

After searching for the appropriate medium to create smoke (incense didn’t make enough to be very visual), my friends and I settled on using dry ice.

Here’s a picture with the lights on.

Pouring dry ice vapor through a plane of laser light.

And another with the lights out, this time of just a cube of dry ice held above the laser:

Dry ice cube held in a plane of laser light

The whole device was really easy to build (most computer case fans take 12 volts DC and you can get small mirrors at art supply stores). If you do end up making one of these devices, just please remember to be safe around lasers and dry ice. Never look a laser in the eye and never keep dry ice in an airtight container (it will explode).

And I’ll leave you with a video:

Oh, and thanks to Julia for helping and Jon for the photography.

Written by gregklein

January 26, 2012 at 1:53 pm

Posted in math

Fun with an HP 7475 Plotter

with one comment

So I got an HP 7475 Plotter used. I’ve been playing with it using a Python library called Chiplotle.

Recently I’ve been making fractals on it. Here’s a Hilbert curve I made:

Hilbert curve on a plotter

Hilbert curves are space filling fractal curves. This means that when iterated to infinity, at no point is there a straight line; thus it is a curve. Very neat!

Iterated deeper this time

In order to get this to work, I wrote a turtle graphics class for the Chiplotle library. If anyone finds this useful, you can grab the code here.

Oh, and here’s a Sierpinski triangle:

A Sierpinski Triangle

Written by gregklein

January 16, 2012 at 9:05 pm

Posted in fractal, math, python

LEDs on a String

leave a comment »

Okay, so a friend and I got bored and decided to play with this idea. We attached a few leds to some thin string (we used dental floss), creating a pendulum. Then we turned off the lights, pointed a camera up, opened the shutter for about 25 seconds and released the led:

A 25 second exposure of a single red led.

And then we tried making a double pendulum by adding a second, green, led.

And again, but with two leds to create a double pendulum.

Double pendulums are neat! They’re incredibly complex despite their simple construction, but can be correctly modelled with math.

Here’s our setup for the double pendulum. And remember, if you decide to try this, use a resistor in series with each led.

The double pendulum with the lights on.

Written by gregklein

November 14, 2011 at 4:49 pm

Posted in math

Tagged with , , , ,

Buddhabrot 4-Dimensional Rotation

leave a comment »

I’ve been playing with fractals recently. More specifically, the Buddhabrot fractal.

The Buddhabrot set is closely related to the Mandelbrot set: Z_{n+1} = Z^2_{n}+C

The mandelbrot set is displayed on the complex plane, where one axis is the real component of C (we’ll call it C_r) and the other is the imaginary component of C (a.k.a C_i).

With the Buddhabrot set, we can add a few more axes. Instead of just using C_i and C_r, we also use the real and imaginary components of Z_0 as axes. Whereas in the Mandelbrot set, Z_0 is assumed to be 0+0i, in our 4D Buddhabrot set, we make these values variable as well.

So instead of the two dimensional image you’re used to seeing of the Mandelbrot set, we’ve instead got 4 axes: C_i, C_r, Z_i, and Z_r.

Which leads us to our next problem — how do you visualise a 4 dimensional object on a computer? Well, it’s difficult. You obviously can’t just draw an image of it, or even just show a 3 dimensional picture of it. Instead, we show it rotation in 4 dimensional space.

So, here’s the result:

I’ve made all of this code open source — here’s the project page.

Written by gregklein

May 16, 2011 at 1:55 am

Posted in fractal