Posts Tagged ‘sage’

Arithmetic Derivative Graph and Thoughts

April 11, 2011

A recent thread on r/math brought the arithmetic derivative to my attention. It’s a very interesting idea. As I tried to rap my head around it, I wished I had a graph of its actions on some of the natural numbers. So I made one:

The Arithmetic Derivative as a graph on natural numbers

(more…)

3D printing of Mathematical Objects!

August 21, 2010

 

 

 

Back in the fall I did some work on getting hacklab.to‘s 3d-printer to print mathematical objects created in sage. Unfortunately, shortly after I got it to work and printed a test sphere, the 3d printer broke. Thus began a long succession of the makerbot — nicknamed the break-r-bot — being fixed and broken… spending most of its time broken.

But recently it was fixed and I decided to dig out my old code and get to work on it.

(more…)

Gamma Fractals

February 12, 2010

There doesn’t seem to have been much done in the way of studying fractals of iterated functions involving gamma. At least nothing that I could find.

So I started playing around with it. It’s a bit difficult to work with as sage (4.3.2) keeps crashing when I try to plot it (try to run complex_plot(gamma(gamma(x)), [-10,10], [-10,10]) or complex_plot(gamma(gamma(gamma(x))), [-5,5], [-5,5]) ), but I still got some pictures…

Identity

Gamma Function

\Gamma^2 (Gamma of Gamma)

Fractals with non-Integer powers

February 11, 2010

I mess around with fractals a lot, and sometimes stumble on some interesting things. Recently I came across some odd jagged/discontinuous fractals:

Julia Set of z \to z^{\frac{3}{2}}+0.4+0.1i

This tends to happen in fractals as soon as I involved non-Integer powers.

Why is this happening? To understand this, we need to look at some basic complex analysis.

Recall that a complex number can be interpreted as a vector like (real, imaginary). But we can also think if a vector in terms of direction and magnitude. For our purposes, we will think of vectors as a magnitude and an angle from the positive portion of the real number line (sometimes called the `argument,’ we will just call it the angle).

Complex numbers have the interesting property that when we multiply them their magnitudes multiply like normal numbers but their angles add. For example, -1 has an angle of \pi so when we multiply two of them we end up with a magnitude of 1 and an angle of 2\pi and thus 1.

When we raise a value to a real power, the angle is multiplied by that value. We can visualise this as:

z \to z^2
\implies

It’s fairly clear that for the inverse, for any value, there are two valid answers.

\implies
z^2\to z

We can also look at it with an alternative visualisation I just cooked up:

Notice that the angle of the ray of discontinuity is arbitrary, but its existence is inevitable.

(For more on complex analysis, I recommend Visual Complex Analysis by Tristan Needham (Google Books, Amazon). It’s awesome!)

(Sage users: Here is a generalised version of the function I used to make the above image. It takes a value n and returns a visualisation of the nth root:


def root_visualize(n):
 l=[]
 for j in range(n*8):
 l.append(complex_plot(lambda x: (x*exp(-sqrt(-1)*j*pi/4))^(1/n)*exp(sqrt(-1)*j*pi/n/4),[-5,5],[-5,5]))
 print j
 return animate(l)

Be warned: it is slow)

Now, notice that z^{1.5} is the same as z\sqrt{z}. Thus, it has the same discontinuity. That seems like a reasonable answer to “why is this so jagged?”

But it leads to some interesting questions. The intuitive reaction is (for me at least): part of the fractal is missing. You’re cutting apart the nice, smooth mutlifunction and thus are only seeing part of the fractal. Well, at n iterations there 2^n possible ways to have cut this hypothetical super-fractal (as I will refer to it).

Let’s look at the Julia super-fractal of z\to \pm z^{1.5}+0.3 for four iterations…

If you stare at all the possibilities of the forming set you will notice some patterns and what look like reciprocals and other patterns. One may intuitively wish to add them to extract a single fractal, but this isn’t possible since they’d cancel… Perhaps adding the absolute values?

(For more on the formation of fractals, see my previous post.)

Of course, one really should look at a larger number of iterations than I am. There is the small problem of this being O(n*2^n), but it should be easy to parallelize…

So that’s the extent that I’ve explored this to so far. I’d be thrilled to get some feedback. Do you have any thoughts about this? Know of similar things that have been studied? (I’ve never formally studied Chaos Theory and suspect I have lots of holes in my knowledge. Reminder to self: take/audit course on chaos theory next year…)

Formation of Escape-Time Fractals

December 19, 2009

We’ve all seen images of escape-time fractals. But have you ever wondered how they form? I was playing around with sage‘s complex_plot function and got some interesting images…

For reference, here is the identity function (notice that it is also the zeroth iteration: f^0(x)=x).

Identity Function

Mandelbrot Set Example

Recall that the definition of the Mandelbrot set is \left\{x|x\in \mathbb{C}; \lim_{n\to\infty}(z\to z^2+x)^n(x)\neq\pm\infty\right\}. (If this is notation confuses you, you may wish to refer to my previous post on anonymous functions.)

Iteration 1

(z\to z^2+x)^1(x) (equivalent to x^2+x)

Iteration 2

Iteration 2

(z\to z^2+x)^2(x) (equivalent to (x^2+x)^2+x)

Iteration 3

(z\to z^2+x)^3(x) (equivalent to ((x^2+x)^2+x)^2+x)

Iteration 4

Iteration 4

(z\to z^2+x)^4(x) (equivalent to (((x^2+x)^2+x)^2+x)^2+x)

Iteration 5

Iteration 5

(z\to z^2+x)^5(x) (equivalent to ((((x^2+x)^2+x)^2+x)^2+x)^2+x)
Iteration 6

Iteration 6

(z\to z^2+x)^6(x) (equivalent to (((((x^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)
Iteration 7

Iteration 7

(z\to z^2+x)^7(x) (equivalent to ((((((x^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)
Iteration 8

Iteration 8

(z\to z^2+x)^8(x) (equivalent to (((((((x^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)
Iteration 9

Iteration 9

(z\to z^2+x)^9(x) (equivalent to ((((((((x^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)

Iteration 10

Iteration 10

(z\to z^2+x)^10(x) (equivalent to (((((((((x^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)^2+x)+x)

Julia Set of 0.3 Example

We can do this with other fractals. Recall that the Julia Set of 0.3 is defined as \left\{x|x\in \mathbb{C}; \lim_{n\to\infty}(z\to z^2+0.3)^n(x)\neq\pm\infty\right\}.
Iteration 1 of the Julias Set of 0.3

Iteration 1 of the Julias Set of 0.3

(z\to z^2+0.3)^1(x)  (equivalent to x^2+0.3)
Iteration 2 of the Julia Set of 0.3

Iteration 2 of the Julia Set of 0.3

(z\to z^2+0.3)^2(x)  (equivalent to (x^2+0.3)^2+0.3)
Iteration 3 of the Julia Set of 0.3

Iteration 3 of the Julia Set of 0.3

(z\to z^2+0.3)^3(x)  (equivalent to ((x^2+0.3)^2+0.3)^2+0.3)
Iteration 4 of the Julia Set of 0.3

Iteration 4 of the Julia Set of 0.3

(z\to z^2+0.3)^4(x)  (equivalent to (((x^2+0.3)^2+0.3)^2+0.3)^2+0.3)
And so on…
Update:
Here is a far more developed and higher resolution image of the Julia set of 0.3.I don’t know what the red is.
Julia Set of 0.3

Complex plot of the Julia Set of 0.3

Here is a animation of the transition of generalised Mandelbrot set from the power of -4 to 4, inspired by this Youtube video:
Generalized Mandlebrot from the power of -4 to 4

Generalized Mandlebrot from the power of -4 to 4

Update 2:

Here are animations of the forming Mandlebrot set and Julia set respectivly:

Formation of the Mandlebrot Set

Formation of the Mandlebrot Set

The Formation of the Julia Set

The Formation of the Julia Set


Follow

Get every new post delivered to your Inbox.

Join 466 other followers