Ideas in the Night

Tag Archives: Mathematics

The Cantor’s set is somewhat fascinating fractal, when one gets to more familiar with it.

The basic idea is to handle real number interval [0,1]. This is divided to three parts of same width removing the middle part. The remaining parts are again divided to three parts of same width removing always the middle part. This is continued infinitely.

The Cantor’s set consists of the points that are left in this process.

In the language of the set theory the Cantor’s set can be expressed as follows:

Cantorin joukko

The union tells what doesn’t belong to the set.

I have used this formula to implement the Cantor’s set in my program. The idea is to examine the union interval and draw a pixel, when the point does belong to the set.

Below is a picture from the program’s output:

Cantor set

 

Here’s the Java program in full:

import java.awt.*;
import javax.swing.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
import java.lang.Math;

public class Cantor {

    private JFrame frame;
    private CantorPanel panel;
    
    public Cantor() {
        frame = new JFrame("The Cantor's Set");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        initialize();
        frame.pack();
        frame.setVisible(true);
    }
    
    private void initialize() {
        panel = new CantorPanel();
        frame.getContentPane().add(panel);
    }
    
    public static void main(String args[]) {
        new Cantor();
    }
}
    
class CantorPanel extends JPanel {
    
    public CantorPanel() {
        
        setBackground(Color.lightGray);
        setPreferredSize(new Dimension(1024,100));
    }
    
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D)g;

        drawCantor(g, 7);
    }
    
    public void drawCantor(Graphics g, int maxIter) {
        
        int y = 17;
        
        for (int m = 1; m < maxIter + 1; m++) {

            for (int x = 0; x < 1024; x++) {
            
                if (belongsToSet(m,x) == true) g.drawOval(x,y,1,1);
            }
            y = y + 10;
        }
    }
    
    public boolean belongsToSet(int m, double x) {

        double line = 1024;
        double x1,x2;

        for(int mm = 1; mm < m ; mm++) {
                
            for (int k = 0; k < (int)((Math.pow(3,(mm-1))) - 1 + 1); k++) {

                x1 = (3.0*k + 1) / Math.pow(3.0,mm);
                x2 = (3.0*k + 2) / Math.pow(3.0,mm);
            
                if ((x > x1 * line) && (x < x2 * line)) return false;
    
            }

        }
        return true;
    }
    
}

Because of the calculation precision with “big” number of iterations drawing accuracy isn’t very good.

The program is free for personal and educational use.

On Georg Cantor

Advertisements

Let’s have some fun with the Pythagorean theorem, we’ll deduce the general equation of circle in R2 with the Pythagorean theorem.

The Pythagorean theorem states that right triangle’s sum of squares of the other sides equal to the square of the hypotenuse: a2 + b2 = c2.

kolmio
The definition of the (analytical) circle: The set of the points that’s distance from a given point P is constant r.

In the picture below is drawn to plane to arbitrary a position a circle, that’s center is P = (x0, y0). Inside the circle is drawn a right triangle that’s other side’s end point is (x, y‘) and the other’s endpoint is (x‘, y).

ympyrä

 

Now the horizontal side’s length is |xx0| and vertical sides’s length is |yy0| and hypotenuse again is r, when according to Pythagorean theorem

(|xx0|)2 + (|y – y0|)2 = r2
<=> (xx0)2 + (y – y0)2 = r2

Because square is positive, the absolute values can be removed and what’s remaining is the familiar general equation of circle.

The simplest case is the circle where the center is at origin.

Then the length of sides of the right triangle are

|x – 0| = |x| and |y – 0| = |y|

and the hypotenuse is again r, when according to Pythagorean theorem

x2 + y2 = r2

I don’t know how ”official” way to deduce the equation of circle this is, but at least this gives the result… 🙂

There is story behind all this that began in the beginning of the year 1999…


First, ∞ is not number. It’s symbol for infinity. For example in the natural numbers set N (the set of all positive integers), there are infinite number of numbers, but none of them is ∞.

But now to the example…

What is 1? Layman probably would say that that’s 1, but according to mathematicians 1 is not defined; we can’t say (at least by our understanding on infinity we have at the moment) what it is.

But what if we get ”close” to 1? Let’s examine following:lim2

From arithmetic operations in infinity we remember, that

 

lim3

So what we have at the first limit sentence is ”1 ” and for

lim2

an exact value can in fact be determined! It’s the Napier’s number e, that’s an irrational number i.e. its decimal representation is infinite. It’s approximately 2.718281828459.

What I presented here, I came familiar with on my first university year.

On Infinity on Amazon


I remember the time when I was still studying at lukio (equivalent school is high school in the US, gymnasium in Sweden, Gymnasium in Germany) when there were exercises to determine positive integer powers of imaginary unit i. I invented at that time a method to easily determine the power without using the taught method of grouping the exponent. Later on my university times I invented a formula to determine arbitrary real number power of imaginary unit i.

The method

Complex number z is of form z = a + bi, where the previous is the real part and the latter the imaginary part. Now we’re interested only in imaginary unit i. So we examine complex number z = i, the magnitude of i = 1.

The argument (arg) of imaginary unit i is 90°. From this fact it follows that multiplying with i corresponds 90° rotation on the complex plane. Thus, if the exponent is a positive integer, there’s exactly 4 possibilities for the power of i: 1, -1, i, -i.

yksikkoympyra

 

The power can be determined by dividing the exponent by 4 and examining the decimal part of the division. There are now 4 possibilities: .0; .25; .5; .75. These tell how many percent of unit circle on the complex plane has been rotated.

Based on this the following table can be presented:

table

The first line is the decimal part of division by 4 of the exponent, the second line tells place in the unit circle of the complex plane, the third line tells the the power of imaginary unit i.

For example to determine i12345678 , we first divide the exponent 12345678 by 4, the result is 3086419.5. The decimal part is .5, so we see from the table above, that the power is -1.

The formula for arbitrary real number exponent

I invented this formula myself some time in the year 1997 when I was studying for the second year at the university of Jyväskylä. I thought my formula was too simple, so I didn’t show it to the maths department staff. Anyway, the formula is as follows:

ipowx

Many years ago, I asked on local science magazine’s net forum, that does this kind of formula already exist. The existing formula was a bit different. In the same forum one reader presented a proof to this formula.

On Complex Numbers


Many years ago when I was studying for the second year in the university of Jyväskylä in one sleepless night I somehow invented how to determine logarithm of negative real number, although I had only basic knowledge of complex numbers. And yes, the logarithm of negative real number is, of course, a complex number.

Now to the formula…

Let x ∈ ℜ and x < 0 and k > 1. Now

I was able to prove this formula in less than 30 minutes, about one A4 paper of proof. Next morning I showed my proof to one person at staff of department of mathematics at university of Jyväskylä (Finland). He didn’t find anything wrong in my proof. A tricky part was a situation where there was two variables in one equation in my proof, but the other varibale had as coefficient sin π that equals 0, so the other variable was eliminated from the equation. I don’t have the proof anymore and I don’t really remember any relevant details of my proof other than I used Euler’s formula (*) in some part of the proof that I had become familiar with in course of differential equations.

(*) As far I can see, the formula probably was the following:

ex + iy = ex(cos y + i sin y)


According to Galileo, the laws of the nature have been written in the language of the mathematics but can one say that there is mathematics in the nature? I mean, does mathematics exists in the nature?

The mathematics itself known by us is abstract, conceptual, in other words it “lives” in the world of ideas separately from physical world that can be touched. Some have interpreted, that the mathematical laws that describe the universe are irrespective of the human being and have always existed; the human being has discovered them by reason. And the discovering still continues.

But it is quite difficult to say that how mathematical laws could have always existed. How about the pure math itself, without any applications? Without its “invention” or “discovery” it would not have been possible to present the mathematical laws that describe the universe, the laws from which some people say, that those laws have always existed.

Fractals are again in fashion, but I’ll take as an example from mathematics the Fibonacci sequence. It conceals the golden ratio in it. In the nature this ratio can be detected by measuring everywhere where there are spirals (a geometric interpretation of the Fibonacci sequence), in the galaxies, in the flowers, in the human body itself… And also in music. Even in DNA.

“Universe”

ID-10032230

Image courtesy of scottchan at FreeDigitalPhotos.net 

In addition, this ratio appears to represent beauty in the nature. It’s no wonder, that this ratio has been used in art and architecture, and much more. Also, in the human body this ratio represents beauty. When the features of human face reflect this ratio, the face is generally considered to be beautiful. The teeth are considered to be very well constructed, when they retell the golden ratio. The 2010 dentist magazine (in Finland) says that the maxillary tooth crowns of clinical relations should follow the so-called “golden ratio”.

This ratio is irrational number, i.e., its decimal representation is infinite. The exact value is

½ (1 + √5)

which is a value of approximately 1.61803.

First 7 Fibonacci numbers are  0, 1, 1, 2, 3, 5, 8. The idea is that the next number is the sum of the two subsequent numbers in such a way that the sequence starts from zero, then follows to ones (sometimes the sequence is presented to start with two ones). Thus the next number in the sequence is 13. The golden ratio starts to form, when a sequence is continued far enough and two consecutive digits are divided by each other, the bigger by the lower. The limit in the infinity seems to be the golden ratio.

The Fibonacci sequence has been compared with the the universe so that like Fibonacci sequence has as a start but not an end, Fibonacci sequence is like the universe: It has a beginning, but not an end. Furthermore the Fibonacci sequence is interpreted to be very fundamental to the whole universe. But what the universe would now approach? Perfectness? Perfect beauty? One expression of beauty? Another view to the universe is, that it has an end, though.

How can such a simple formula can define beauty? How can something so simple be so fundamental to the entire universe? I must say that there’s still much to “discover”.

Does the great truth loom In the infinity, always one step ahead; just when we think, we have discovered something, there’s something else or new in the next step. But we already know what’s out there in the infinity: ½ (1 + √5)!

Previous chapter was my humor about comparing the Fibonacci sequence to the universe, because there is too much mystique attached to the sequence. It’s believed that big-money conspiracy is hiding the truth about the connection between Fibonacci sequence and the universe, so that people wouldn’t know the truth. It’s also believed that the Fibonacci sequence is some kind of sign of God’s mathematical designing of the universe (I don’t deny the existence of God, but I would criticize the idea that the Fibonacci sequence would be a sign of God)

So the golden ratio can be found in the nature by measuring, but does the quotient of two subsequent numbers of the Fibonacci sequence approach in the nature the golden ratio? I mean that in the nature there exist no numbers at all! Even in this blog post there exists no numbers, but logical representations of numbers as Ludwig Wittgenstein would put it. And he is right.

But in the nature there can be found patterns through interpretation, mathematical patterns. Also there’s no knowledge without interpretation, information must be interpreted. But this interpretation is only in the mind of interpreter. So what is there in the nature? A human being. According to the interpretation.

On Fibonacci on Amazon