Category Archives: Mathematics

A math operation table for kids

I had such a thing in Greece when I was a kid. By pulling the i-th and j-th band on a plastic board their product was being revealed. That's how I had learned the multiplication table very quickly.

I wanted to buy something like this for my little one, but I couldn't find anything similar. All math tables work now with buttons. So I decided to construct one by myself.

At first I designed it with xfig: the prototype is table and the full elements are board and leisten. Then I printed them on 300gr carton and cut them accordingly; the board:

20160130_212859and the bands:

20160130_212923which were also cut into 20 elements:

20160131_114614Then I put it all toghether:

  1. bottom carton
  2. temlate carton, where I wrote the numbers but after putting it inside
  3. horizontal bands
  4. vertical bands
  5. cover carton with 100 quadratic holes
  6. stickers (s. below)

I fixed the band sliding by attaching small white stickers on the boundary between the bands (width = 1.4mm). On the right hand side, I fixed paper pieces with paper glue on the front side and post-it glue on the back side, so that I can pull them off and change the number board inside the construction (e.g. this one is for addition, I can change the template inside for sutraction or multiplication). Here the board with all squares closed:

20160201_121539Here with all bands open:

20160201_121722

And here some operations:

20160201_12160720160201_121628

 

A simple steganographic algorithm

I invented today a simple steganographic algorithm inspired by Problem 67 of the Project Euler. I do not know if the algorithm exists, I did not find something after an internet search. If you know anything about, please post to me; I will then cite properly.

  1. Encrypt the data in say data.enc.
  2. Split data.enc in 100 blocks of sizes s1, s2, ..., s100: files E1,E2, ..., E100.
  3. Create 1+2+3+...+100 = 5050 files with random data with 1 file of size s1, 2 files of s2 etc.
  4. Now create a tree structure in the files like:
    F0
    F1 F2
    F3 F4 F5
    F6 F7 F8 F9
    ...
    by doing the following: rename the 5050 files so that every one (except 100) points to the 2 children files in the tree structure you want to achieve:
    F0_F1-F2
    F1_F3-F4 F2_F4-F5
    F3_F6-F7 F4_F7-F8 F5_F8-F9
    ...
  5. Rename E1,...,E100 to a random data file from the previous tree, one from each level, e.g.
    E1 -> F0_F1-F2
    E2 -> F2_F4-F5
    E3 -> F3_F6-F7
    ...
    If you go to the right of the tree register 0, if to the left, register 1. Go to the right or to the left with the same probability.
  6. Flatten the date stamps of all files.
  7. You have registered a sequence of 99 digits of 0 and 1. Translate this binary number to decimal and memorize the number easily. It is a natural number n, with 0≤n<299=633,825,300,114,114,700,748,351,602,688.

Now, only you know the route. It is not advisable for an attacker to try brute force in order to find the original data. As in the case of Problem 67, "if you could check one trillion (1012) routes every second it would take over twenty billion years to check them all." 😉

A quiz for bike riders

After riding the bike many days on the same roads, I came to the following interesting exercise: find a speed, such that you can reach your destination with this speed without having to stop at a red light. Of course we assume, that we always stop at red light.

So the exercise is the following. Consider a finite number of traffic lights, a_0, \ldots,a_n, and suppose that the bike rider starts when a_0 becomes green. Then let T_1,\ldots,T_n be the times for which the respective lights are green, and F_1,\ldots,F_n be the times for which the lights are red. Further, let d_1,\ldots,d_n be the distances between the lights, and suppose that we know at t = 0 the remaining green or red time for every light. Let these times be R_1,\ldots,R_n with positive times for remaing green and negative for remaining red time. Determine the set of all possible constant speeds (also unrealistic) for which the rider can pass through without having to stop.

 

P.S. (R_1,\ldots,R_n) could be any n-tuple from \{(x_1,\ldots,x_n)|x_i \in [-F_i,T_i] \}

P.S.2 He he, it is easy to find some trivial funny unrealistic solutions. But we want all solutions!

A combinatorics quiz

Let's consider the connexion between two persons from the mothers' side and count the possibilities to express it. E.g., if the connexion is only 1 generation, then there is only 1 possibility to express it:

  1. the mother.

If the connexion is 2 generations, then there are 2 possibilities to express it:

  1. the mother of the mother
  2. the grandmother.

If the connexion is 3 generations, then there are 4 possibilities to express it:

  1. the mother of the mother of the mother
  2. the grandmother of the mother
  3. the mother of the grandmother
  4. the great-grandmother.

If the connexion is 4 generations, then there are 7 possibilities to express it:

  1. the mother of the mother of the mother of the mother
  2. the mother of the mother of the grandmother
  3. the mother of the grandmother of the mother
  4. the grandmother of the mother of the mother
  5. the grandmother of the grandmother
  6. the mother of the great-grandmother
  7. the great-grandmother of the mother.

Now, if the connexion is 100 generations, how many possibilities are there to express it by using only the words "mother", "grandmother", "great-grandmother", "the" and "of"?

Calculate the same for 1000 generations. Can you have the answer in less than 10 seconds? (10'' of computer calculations)

Here is my answer.

Update:

Damn it! I have just guessed an algorithm, that can calculate this in linear time and in less that 1 sec! Can you guess it too? ;o)

Here is my second answer.

Project Euler

Project Euler is a project that offers mathematical problems that should be solved by computer programming. The problems are easy to understand and a theoretical solution is always obvious. But... a solutions is regarded as acceptable, if the algorithm that is applied lasts at most 1 minute. And of course the problems have such parameters that make brute force inefficient. So the ambitious solver has to invent good ideas or look for some in mathematical books, that solve the problem quickly.

Solving or just dealing with a problem makes much fun, because one experiences the power of mathematics and recalls old or learns knew knowledge.

Recommended to everyone who loves mathematics and programming!

Here is the webpage.

The Adventure of π to the Normal distribution

Today, after giving the definition of the normal distribution a student asked me a very interesting question: how does the number π emerge in the Gaussian curve? The question is legitimate, because the Gaussian curve does not show any relation to the circle curve. I improvised an brief answer, and I will try to give here the path of this fascinating adventure of π. Firstly, the distribution function of a normal distributed random variable with expectation μ and variance σ2 is

\displaystyle\Phi(x)=\int_{-\infty}^{x}\frac{1}{\sqrt{2\pi\sigma^2}} e^{-\frac{(t-\mu)^2}{2\sigma^2}}dt

and its limit is

\displaystyle\lim_{x\rightarrow\infty}\Phi(x)=\int_{-\infty}^{\infty}\frac{1}{\sqrt{2\pi\sigma^{2}}}e^{-\frac{(t-\mu)^{2}}{2\sigma^{2}}}dt=1

This is a normalised form of the Poisson integral:

\displaystyle\int_{-\infty}^{\infty} e^{-x^2}dx = \sqrt{\pi}

Now the question is why this equals  \sqrt{\pi} . For this I would give 2 answers:

1. Path

Substitution x2=t gives

 \displaystyle\int_0^\infty e^{-x^2} dx =\frac1 2\Gamma \left(\frac 1 2\right) = \frac{\sqrt{\pi}}{2}

And how is \Gamma \left(\frac 1 2\right) = \sqrt{\pi}?

This can be explained over the Gauss form of the Gamma function:

 \displaystyle\Gamma (x) = \lim_{n\rightarrow\infty}\frac{n!n^{x-1}}{\prod_{i=0}^{n-1} x+i} = \lim_{n\rightarrow\infty}\frac{n!n^{x}}{\prod_{i=0}^{n} x+i}

These 2 different forms give at ½ when multiplied with each other the double of the Wallis product:

 \displaystyle 2\lim_{n\rightarrow\infty} \prod_{k=1}^n \frac{k^2}{k^2 - \frac 1 4}=\pi

Now, why does W(n):=\frac{k^2}{k^2 - \frac 1 4} \prod_{k=1}^n converge to \frac \pi 2 for n\rightarrow\infty (Wallis product)? This is because of the recursive relation

 \displaystyle \int_0^{\frac \pi 2} \sin^nxdx = \frac {n-1} n \int_0^{\frac \pi 2} \sin^{n-2}xdx

The recursive resolution of the terms of the following fraction yields:

\displaystyle1=\lim_{n\rightarrow\infty}\frac{\int_0^{\frac \pi 2}\sin^{2n+1}xdx}{\int_0^{\frac\pi 2}\sin^{2n}xdx }=\lim_{n\rightarrow\infty}W(n)\frac 2 \pi

and therefore the equation of the Wallis product.

We see here that π comes from the sine function to the approximation of the Wallis product, then as the value of Γ(½) and from there it evaluates the square of the Poisson integral. A long path!

2. Path

The second path that I will present is shorter and more direct. Because

\displaystyle\left(\int_{-\infty}^{\infty} e^{-x^2}dx\right)^2=\int_{R^2} e^{-x^2-y^2}dxdy

calculating the left side should give the expected result (π). This can be done by integrating over a circle with centre in 0 and radius a (B(a)) and then by transformation to polar coordinates:

\displaystyle\lim_{a\rightarrow\infty}\int_{B\left(a\right)}e^{-x^{2}-y^{2}}dxdy=\lim_{r\rightarrow\infty}\int_{0}^{2\pi}\int_{0}^{r}re^{-r^{2}}drd\phi=\pi


References:

Forster Otto: Analysis 1; Differential- und Integralrechnung einer Veränderlichen, 6,. verbesserte Auflage, o.O., vieweg, 2001.

Κουνιας Στρατής, χρόνης Μωυσιάδης: Θεωρία Πιθανοτήτων Ι, Κλασική πιθανότητα, μονοδιάστατες κατανομές, Θεσσαλονίκη, Εκδόσης Ζήτη, 1999.


PS. Wikipedia has an interesting article about the calculation of the Gaussian integral.

Sage

In the last weeks I was introduced to Sage. What is Sage? The first paragraph of the tutorial says:

Sage is free, open-source math software that supports research and teaching in algebra, geometry, number theory, cryptography, numerical computation, and related areas. Both the Sage development model and the technology in Sage itself are distinguished by an extremely strong emphasis on openness, community, cooperation, and collaboration: we are building the car, not reinventing the wheel. The overall goal of Sage is to create a viable, free, open-source alternative to Maple, Mathematica, Magma, and MATLAB.

I have tried it for some weeks and I am very impressed. At this time (version 4.6) 95 open-source packages are combined in Sage. I name here some of them: Python, Maxima, R, Singular, GSL, LAPACK, BLAS.

The Python-based interface is also very convenient and the "notebook"-worksheets in the webbrowser with typeset formulas offer a nice GUI-interface.

Surely a mathematical tool that I will use for a long time! 🙂

Here is the webpage.

An Application of the Fibonacci Sequence in Music

Every mathematician and almost every composer knows the Fibonacci sequence:

 \begin{array}{ccl}F_0 &=& 0\\F_1 &=& 1\\F_n &=& F_{n-1}+F_{n-2},\ \ \ n>1\end{array}

The first 11 members of this sequence are: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55.

This sequence is one of the most used sequences in music. Of course I could not be an exception as a composer. My particular use of the sequence is that I used it modulo 12 (beginning from 1), that is the rests of the division of the  Fibonacci numbers by 12. The period of this is 24:1

i Fi Fi mod(12)
1 1 1
2 1 1
3 2 2
4 3 3
5 5 5
6 8 8
7 13 1
8 21 9
9 34 10
10 55 7
11 89 5
12 144 0
13 233 5
14 377 5
15 610 10
16 987 3
17 1597 1
18 2584 4
19 4181 5
20 6765 9
21 10946 2
21 17711 11
23 28657 1
24 46368 0

Translated to pitches, it results for gis as 0:

Fibonacci Row with 24-tones

I discovered this —mathematically trivial— result in 1995. Here some observations I did at that time:

  • The sequence can be divided in two halves: the second equals the first stretched at 1 perfect fourth and transposed 4 half-tone higher
    (e.g. a-ais-b equates to cis-fis-b).
  • Notes 24,1-6 form the complementary set of 12-18 (also symmetrical property).

[For more interesting relations, see the linked image at the end.]

According to the 2nd observation I was high motivated to build a 12-tone row with notes 24,1-6 for the 1st half and notes 18-12 for the second half in the appropriate transposition:
12-tone row based on the above fibonacci 24-tone row"

I have used this 12-tone row for my early Fugue for Orchestra and Composition I for piano. Then I used the whole 24-tone row for Transpositionen (ensemble) and Konzert (2nd movement, piano). I have kept the sketches with some observations that I did to this before composing the 2nd movement of Konzert here (image size 11MB).


  1. Every sequence of the Fibonacci sequence residua is periodical.

Tutorium at the TU

Now that I see again my solution in the previous post, I realise the ratio of my work to the payment at that time much better. In Summer term 2009 I was working for this Tutorium:

4h teaching
+ 2h consultation
+ 2h solving the exercises of the home work
+ 4h correction of the students' home work
+ 2h preparation of the tutorium exercises
+ 4h writing/uploading extra stuff (s. previous post)
Sum = 18h per week

+ 2h as invigilator during the exams + 6h correction of the exams at the end.

And the only hours that were paid, were the teaching hours.

Ok, I did it for one term. And at the end I received a very good evaluation from the students. And after the exams, some students sent me an email, thanking me for my work as a tutor.

Now, what would you expect from the university administration, if you had such a member of the teaching stuff? Life showed, that the only thing that I had to expect as a scientist, was a job for the next term like the previous one: that is, working for 18h and getting paid for 4h.

I made up my mind considering the following: If you want to be respected, then first of all you have to respect yourself. This was the first and last term working for the TU.