MATHEMATICS

Tampilkan postingan dengan label Discrete Mathematics. Tampilkan semua postingan
Tampilkan postingan dengan label Discrete Mathematics. Tampilkan semua postingan

Kamis, 08 Desember 2011

Combinatorica

The following function in the Mathematica Combinatorica package ShowGraphArray[Partition[FiniteGraphs, 4]] produces the following graphic.


I found it in the book 'Computational Discrete Mathematics, Combinatorics and Graph Theory with Mathematica, by Sriram Pemmaraju and Steven Skiena, Cambridge 2003.' It's not the typical Proposition / Proof mathematics book but it does give you access to about 450 -practical- freely available ( if you have Mathematica ) tools to extend your problem solving toolkit.

Jumat, 22 Juli 2011

Magic squares - Revisited

Regular readers of this blog know that I am fascinated by magic squares. Finding the 3 by 3 magic square with digits 1,2, ..., 9 can be formulated as an Integer Programming problem. An Integer Programming problem is a Linear Programming problem with the additional constraints that all variables must have integer values.

c={1,1,1,1,1,1,1,1,1};
m={
{1,1,1,0,0,0,0,0,0},
{0,0,0,1,1,1,0,0,0},
{0,0,0,0,0,0,1,1,1},
{1,0,0,1,0,0,1,0,0},
{0,1,0,0,1,0,0,1,0},
{0,0,1,0,0,1,0,0,1},
{1,0,0,0,1,0,0,0,1},
{0,0,1,0,1,0,1,0,0},
{-1,-1,-1,0,0,0,0,0,0},
{0,0,0,-1,-1,-1,0,0,0},
{0,0,0,0,0,0,-1,-1,-1},
{-1,0,0,-1,0,0,-1,0,0},
{0,-1,0,0,-1,0,0,-1,0},
{0,0,-1,0,0,-1,0,0,-1},
{-1,0,0,0,-1,0,0,0,-1},
{0,0,-1,0,-1,0,-1,0,0},
{1,0,0,0,0,0,0,0,0},
{0,1,0,0,0,0,0,0,0},
{0,0,1,0,0,0,0,0,0},
{0,0,0,1,0,0,0,0,0},
{0,0,0,0,1,0,0,0,0},
{0,0,0,0,0,1,0,0,0},
{0,0,0,0,0,0,1,0,0},
{0,0,0,0,0,0,0,1,0},
{0,0,0,0,0,0,0,0,1},
{-1,0,0,0,0,0,0,0,0},
{0,-1,0,0,0,0,0,0,0},
{0,0,-1,0,0,0,0,0,0},
{0,0,0,-1,0,0,0,0,0},
{0,0,0,0,-1,0,0,0,0},
{0,0,0,0,0,-1,0,0,0},
{0,0,0,0,0,0,-1,0,0},
{0,0,0,0,0,0,0,-1,0},
{0,0,0,0,0,0,0,0,-1}
};
b={15,15,15,15,15,15,15,15,-15,-15,-15,-15,-15,-15,-15,-15,9,9,9,9,9,9,9,9,9,-1,-1,-6,-1,-1,-1,-1,-1,-1};
LinearProgramming[-c,-m,-b]

{2, 7, 6, 9, 5, 1, 4, 3, 8}

Mathematica does find a solution in less than a second. An interesting ( Mathematica ) programming exercise would be to generate the code for solving this integer programming problem for magic squares of size n. With increasing n the number of constraints increase fast. This could become an interesting benchmark. - For a 3 by 3 magic square 34 constraints are used above ( although 32 would have sufficed, probably even less ) but these constraints can be systematically generated.

Selasa, 19 Juli 2011

Optimizing profits

Mathematicians like space. Like in vector space, metric space, topological space. In fact, any set with structure can be called a space. In "simple" Euclidean geometry there are all sorts of problems of how to fill a space with as much objects as physically possible. How many spheres of a certain radius can we store in a cube? And so forth. - The Japanese people excel in many areas: architecture, technology. This combined with the special conditions ( a lack of =space= ) in Tokyo lead to extraordinary inventions. The following =must= have been the solution to an optimization problem of some kind. Like maximize the number of hotelrooms ( they must have started with rooms in mind ) given a number of constraint. Or simply maximize profits because I bet this 'cheap' hotel is making more profits than their five star competitors. Thanks to optimization and applied mathematics. No matter how much they love space mathematicians can minimize it for you.



I am Dutch, so somewhat exposed to overpopulation and too many people on limited ( office ) space. I can comfortably stay in any hotel though, no matter how smallish the room.  Not even the German U-boat movie 'Das Boot' gave me the same feeling of claustrophobia.

Jumat, 04 Maret 2011

Different representations of sequences

The following five mathematical objects, i.e.: a sequence, a generating function, a recurrence equation, an arithmetical function and an asymptotic estimate, are all representations of the well-know Fibonacci sequence.

$$(1,1,2,3,5,8,13,21,34,55,...)$$
$$g[x]=\frac{x}{1-x-x^2}$$
$$a[1]=1; a[2]=1; a[n]=a[n-1]+a[n-2]$$
$$F_n = \frac{1}{\sqrt{5}} (\frac{1+\sqrt{5}}{2})^n - \frac{1}{\sqrt{5}} (\frac{1-\sqrt{5}}{2})^n$$
$$f(x)=\frac{1}{\sqrt{5}}e^{x\log{\phi}}$$

So, if we have to solve a problem involving sequences we have various options to choose from to represent the sequence we are working with. I had quite a cognition after my first confront with the consequences of this concept. Summation for example. Summation of a sequence is equal to multiplication with $\frac{x}{1-x}$ in the generating function realm. The GF of $(1,1,1, \cdots )$ is $\frac{1}{1-x}$ which means that the GF of $(1,2,3, \cdots )$ must be $\frac{x}{(1-x)^2}$.

Kamis, 24 Februari 2011

The concrete tetrahedron

I once wrote that I rated Concrete Mathematics 6 out of 5 stars. Unfortunately the book was published in the pre LaTeX era. To the eyes or 21st century readers the book simply looks ugly. If you look a bit deeper though you'll notice that you struck gold as far as content is concerned. But... what we can do today on a laptop with Mathematica installed on it was beyond the possibilities of the super computers in the days CM was written. In that respect the book looks out-dated.

Recently a book by Kauers, Palle was published by Springer called 'The Concrete Tetrahedron'. In the book the concrete tetrahedron stands for:
- symbolic sums;
- recurrence equations;
- asymptotic estimates;
- generating functions.

The authors have the following to say about it.
... the present book is not meant to be merely a summary of “Concrete Mathematics”. We have a new twist to add to the matter, and this is computer algebra. In the last decade of the 20th century, many algorithms have been discovered by which much of the most tedious and error-prone work about the four vertices of the Concrete Tetrahedron can be performed by simply pressing a button. We believe that a mathematics student of the 21st century must be able to use these algorithms, and so we will devote a great part of this book to explaining what can and should be left to a computer, and what can and should be still better done the traditional way.

In Apostol's Analytic Number Theory formal power series and Dirichlet multiplication are among the topics. For me that was a reason to refresh, review my knowledge on formal power series and generating functions. ( One of my favorite subjects in mathematics. ) That is how I became aware of this new release.

Link: The Concrete Tetrahedron

Link: Video lectures about Concrete Mathematics

A database of sequences

In the Online Encyclopedia of Integer Sequences ( OEIS ) you can find tons of information on any sequence you can possibly think of.

An example.
A002024 n appears n times.
Starts with: 1,2,2,3,3,3,4,4,4,4,5,5,5,5,5,6, ...
Closed form: a[n] = Floor[1/2 + Sqrt[2n] ]

Amazing.

Jumat, 31 Desember 2010

A conjecture about perfect numbers

Perfect number

In number theory the sum of the divisors is denoted as $\sigma$: $$\sigma(n) = \Sigma_{d/n} d$$ and $s(n)=\sigma(n) - n$ is the sum of the proper divisors. A perfect number is equal to the sum of its proper divisors. All known perfect numbers are even, it is unknown if odd perfect numbers exist. The number $2^{p-1}(2^p-1)$ is perfect if and only if $(2^p-1)$ is prime.

Conjecture

Show that: if $p$ is odd then
$$ 2^{p-1}(2^p-1) = \sum_{k=1}^{\frac{p+1}{2}-1} (2k-1)^3$$
( Notice that $2^{p-1}(2^p-1)$ yields a perfect number if $(2^p-1)$ is prime. )

Example

$6$ is perfect, since $6 = 1 + 2 + 3.$
$28$ is perfect, since $28= 1 + 2 + 4 + 7 + 14.$

Any perfect number ( except 6 ) can be represented as a sum of cubes.
$\begin{array}{ccc}
\underline{p} & \underline{Pf} &\underline{s}\\
3 & 28 & 1^3 + 3^3 \\
5 & 496 & 1^3 + 3^3 + 5^3 + 7^3 \\
7 & 8128 & 1^3 + 3^3 + ... + 15^3 \\
13 & 33550336 & 1^3 + 3^3 + ... + 127^3
\end{array}$

Proof

My exercise for New Year's Day. ( You may have noticed that I like doing 'sums'. ) Later...

( Source:
- A primer of analytic number theory, From Pythagoras to Riemann by Jeffrey Stopple
)

Kamis, 30 Desember 2010

Stirling numbers in Discrete Calculus

Definition

Stirling numbers of the second kind represent the number of k-partitions of an n-set and are recursively defined as $\left\{ 0,0 \right\} = 1$, and $\left\{ n,k \right\} = \left\{ n-1,k-1 \right\} + k \cdot \left\{ n-1,k \right\}$. They are used in the Discrete Calculus to convert powers to factorial powers, i.e. $n^2 = n^{\underline{1}} + n^{\underline{2}}$.

The matrix below shows the Stirling numbers for $n=0$, to $n=5$.
$\left(
\begin{array}{cccccc}
1 & 0 & 0 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 & 0 \\
0 & 1 & 1 & 0 & 0 & 0 \\
0 & 1 & 3 & 1 & 0 & 0 \\
0 & 1 & 7 & 6 & 1 & 0 \\
0 & 1 & 15 & 25 & 10 & 1
\end{array}
\right)$

Example

Calculate $\sum_{k=1}^{n} k^5$.

$\Sigma \Delta k^5$
$=\Sigma ((n+1)^{\underline{1}} + 15(n+1)^{\underline{2}} + 25(n+1)^{\underline{3}} + 10(n+1)^{\underline{4}} + (n+1)^{\underline{5}} )$
$=\frac{1}{2}(n+1)^{\underline{2}} + 5(n+1)^{\underline{3}} + \frac{25}{4}(n+1)^{\underline{4}} + 2(n+1)^{\underline{5}} + \frac{1}{6}(n+1)^{\underline{6}}$
$=-\frac{n^2}{12}+\frac{5 n^4}{12}+\frac{n^5}{2}+\frac{n^6}{6}$
$=\frac{1}{12} n^2 (1+n)^2 \left(-1+2 n+2 n^2\right)$

\begin{array}{lll}
\underline{n} & \underline{n^5} & \underline{\frac{1}{12} n^2 (1+n)^2 \left(-1+2 n+2 n^2\right)} \\
1 & 1 & 1 \\
2 & 32 & 33 \\
3 & 243 & 276 \\
4 & 1024 & 1300 \\
5 & 3125 & 4425
\end{array}

Senin, 27 Desember 2010

Five proofs for the sum-formula of 1+2+3+ ... +n

The running totals of 1,2,3 ... are called the triangular numbers. We will show that $1 + 2 + 3 + \cdots + n = \frac{n(n+1)}{2}$

Proof-1 Gauss's proof

( Gauss supposedly came up with this proof when he was 8 years old. On this page you will find more than 100 different tellings of this story. )
$s = 1 + 2 + 3 + \cdots + n$
$\underline{s = n + (n-1) + (n-2) + \cdots + 1}$
$2s = (n + 1) + ((n-1)+2) + ((n-2)+3) + \cdots + (1+n) \Leftrightarrow $
$2s = n \cdot (n + 1) \Leftrightarrow $
$s = \frac{n(n+1)}{2}$

Proof-2 By induction

Let $S=\left\{ n \in \mathbf{N} | \sum_{k=1}^{n} k = \frac{n(n+1)}{2} \right\}$
Clearly $1 \in S$
Assume, $n \in S$:
$\sum_{k=1}^{n+1} k = \frac{n(n+1)}{2} + (n+1) = \frac{(n+1)(n+2)}{2}$, or $n \in S \Rightarrow n+1 \in S$
Now, since $(S \subset \mathbf{N} \wedge 1 \in S \wedge n \in S \Rightarrow n+1 \in S ) \Rightarrow S=\mathbf{N}.$

Proof-3 With the Pascal Triangle

Because $n^k$ is in the PT for any $k \in \mathbf{N}$, sums of polynomials with integer coefficients can be read from the PT. ( $n={n \choose 1}$, $n^2={n \choose 1} + 2{n \choose 2}$, and so forth. )
$\underline{n}$
0: 1
1: 1 - 1
2: 1 - 2 - 1
3: 1 - 3 - 3 - 1
4: 1 - 4 - 6 - 4 - 1
5: 1 - 5 - 10-10 - 5 - 1
From $n$ we seek the second column, one row down or ${n+1 \choose 2}= \frac{n(n+1)}{2}$

Proof-4 Geometric

Look at the pattern
X
and
X---Y

X
X-X
and
X---Y-Y
X-X---Y

X
X-X
X-X-X
and
X---Y-Y-Y
X-X---Y-Y
X-X-X---Y

The number of X's and Y's are equal. The triangle X-pattern with base of n X's is replaced by a rectangular shape of n+1 by n X's OR Y's.

Proof-5 With Discrete Calculus

The discrete analog of solving a differential equation.
$\Delta f(n) = n+1$
$\Sigma \Delta f(n) = \Sigma (n+1) $
$f(n) = \frac{1}{2}(n+1)^{\underline{2}} + C$
$f(n) = \frac{1}{2}(n+1)n + C$
Since $f(1) = 1, C=0$
$f(n) = \frac{n(n+1)}{2}$

Selasa, 14 Desember 2010

[Video] - Why Pi?

Why Pi? is the title of Don Knuth’s 16th Annual Christmas Tree Lecture. Don Knuth is a famous computer scientist and the designer and programmer of TeX. The first book I seriously self-studied was Concrete Mathematics by Knuth, Ron Graham and Patashnik with beautiful stuff on the Fibonacci series, the Pascal triangle, combinatorial identities, generating functions and numbers and divisibility. It's a beautiful book. I haven't watched the ( entire ) lecture yet, i parked it on my watch-queue.

Kamis, 11 November 2010

Poetry in mathematics.

While I was looking for 'poetry in mathematics', all I could find was this article in the Journal of on-line Mathematics and its Applications (volume 6 October 2006) by JoAnne Growney called Mathematics in Poetry.


As I find it hard enough to describe what I mean by Poetry in mathematics, in my native language Dutch, I won't even give it a try in English. But I would like to show this snippet of math as an example of what I consider deeply poetic. Although the context is math, to me this is poetry, period.

\[\begin{aligned}
1^2 &= 1^3\\
(1+2)^2&=1^3+2^3\\
(1+2+3)^2&=1^3+2^3+3^3\\
(1+2+3+4)^2&=1^3+2^3+3^3+4^3\\
(1+2+3+4+5)^2&=1^3+2^3+3^3+4^3+5^3\\
(1+2+3+4+5+6)^2&=1^3+2^3+3^3+4^3+5^3+6^3\\
\cdots &= \cdots
\end{aligned} \]

$(1,9,36,100,225,441,\cdots)$.

Sabtu, 30 Oktober 2010

Analytical function representing the Fibonacci series

The MST209 exam has a different format than MS221 and M208 have. In 2006, for example, the format was as follows:
Part A. 15 multiple-choice questions, 2 marks each = 30 points. ( 1 hour )
Part B. 8 questions, 5 marks each = 40 points. ( 1 hour 15 min )
Part C. 3 out of 7, 15 marks each = 45 points. ( 45 min )
Yes. Maximum score is 115. Scores above 100 are set to 100.
The exam looks doable. And again questions on eigenvalues and eigenvectors. That would be three in a row: MS221, M208 and MST209. Considering the fact that one can prove Binet's formula for the Fibonacci numbers with them it's worthwhile having it firm under your math-belt.

There is also an analytical function for the Fibonacci numbers which rounded, gives an exact Fibonacci number if the input variable is an integer. Here is the related math.

Let $F_n = F_{n-1} + F_{n-2}, F_0=0, F_1=1$, show that $Fa_n=\frac{1}{\sqrt{5}}e^{n \cdot \log{\phi}}$, where $\phi$ is the Golden Ratio or $\frac{1+\sqrt{5}}{2}$. ( Round $Fa_n$ to get $F_n$. )

If we define the elements $F_{n}$ and $F_{n+1}$ as the vector $s_n= \left(
\begin{array}{c}
F_{n+1}\\
F_{n}
\end{array}
\right)$
then $F_n$ simply becomes
$F_n= \left(
\begin{array}{cc}
1 & 1\\
1 & 0
\end{array}
\right)^n
\cdot s_{0}$.

We can calculate the power of a matrix by diagonalizing the matrix. And this is where eigenvalues and vectors come in. If $\lambda_1, \lambda_2$ are eigenvectors with respective eigenvectors $E= \left( e_1, e_2 \right)$ we get $F_n= E^{-1}
\cdot
\left(
\begin{array}{cc}
\lambda_1^n & 0\\
0 & \lambda_2^n
\end{array}
\right)
\cdot
E
\cdot s_{0}$

The eigenvectors are the roots of the characteristic equation $\left|
\begin{array}{cc}
1-\lambda & 1\\
1 & -\lambda
\end{array} \right| = 0$ and are thus $\frac{1}{2} + \frac{1+\sqrt{5}}{2}$ and $\frac{1}{2} - \frac{1+\sqrt{5}}{2}$.

( TO BE CONTINUED ... )