Archive

Posts Tagged ‘mathematics’

Heidelberg Laurate Forum 2016

I went to the 4th Heidelberg Laureate Forum and it was amazing. I encourage my students to apply and I am sure they will have a wow experience about how mathematics really is. Here is some of my thought about HLF 2016.

1. What an amazing tour, at a wonderful place.
I had an amazing experience, meeting with a lot of laureates, a lot of young and energetic researchers. We discuss a lot of things with one common thing which is mathematics. The meeting place could not have been better and Heidelberg is just perfect.

2. Mathematics meets his little own brother, computer science.
In this event, we did not only talk about math, we also talk about computer science which is so much younger than mathematics.

3.  Frontier between mathematics and computer science is not a fixed boundary, but it is actually an intersection.
Sir Michael Atiyah said this during the workshop. Read many Atiyah quotes here.

4.  Fermat last theorem
We saw the boy who is fascinated by Fermat’s last theorem. He solved it in 1994 and won the Abel’s prize.

5.  Euler proof of infinite prime
I like this proof of infinite prime and he solved it in the eighteenth century.

6. Deep learning perhaps should’t be named deep learning
Noel Sharkey mentioned that machine learning is nothing like learning, instead, it is a statistical parameter optimization.

7. Sometimes when you want to make things tidy, you find a new knowledge. This is what happens in tensor analysis. Vladimir Voevodsky had an idea to help verifying mathematical profs by computers and preserve intimate connection between maths and human intuition. He called this unimath.

8.  Something wrong in computer science education. Leslie Lamport cricitized computer science education as some of computer scientist did not understand the abstraction he made during the talk. He also said “Not every programming languages are as bad as C, but all prevent you from getting to a superior level of abstraction, he proposed Pluscal.”

9. I think Barbara Liskov is the only woman participating as the laureate in this forum. Wondering how many women have won Turing, Abel or Fields medal.

10. The last talk I remember was from Heisuke Hironaka, Fields Medalist in 1970. He gave many advises and one of those are  “Time is expensive, use it well”, ” You learn from your mates more than from your teacher” and” I want to write a book dedicated to my wife ” which was sweet.

I think that is all I can write. I really enjoy my experience in this forum. And now let’s end our journey at Heidelberg castle.

How to compute distance between a point and a line

This semester (Even Semester, 2015-2016) I am teaching a new course, that is called Analytic Geometry or Geometry Analytic, both are the same, I think. Don’t get me wrong, the course is not new, it is just I would be teaching this course the first time. When they told me that I was going to be the lecturer of this course, they did not give me a standard, they did not give me a textbook they normally use, or a list of topics that I must cover, perhaps because this course is not a compulsory course. So, I have a freedom, I can choose topics that I want to teach in Analytic Geometry. The first thing I did, was to browse the internet any textbook about Analytic Geometry or any lecture note. In the end, I pick a textbook (Indonesian book) and I choose some topics of my interest to be the material of this course.

Okay, enough for the background, I am sure you don’t want to hear anymore on that. Let’s get back to main point of this note. Long story short, a straight line became one of the topics in my course, and I was interested on how the formula to compute distance between a point and a line is derived.In this case, I only consider two dimensional case and by distance, I mean the shortest distance between such a point and a certain line, which also means the perpendicular distance. If you don’t remember what is the formula, let me recall you.

Consider a straight line $l$, given by the following equation:

$l : ax + by + c=0$.

Suppose we have a point $P(x_p,y_p)$, then the distance between the point $P$ and the straight line $l$ is

$d = \frac{|ax_p+by_p+c|}{\sqrt{a^2+b^2}}$.

There are other proofs on how to derive the above formula, but I really really like the proof I am going to show you below.  I will divide this note into two section. The first section will talk about a straight line and how to get an equation of a straight line. The latter section will derive the formula.

1. A straight line equation

In high school, I think you must know what conditions we need to have in order to obtain a straight line equation. If we have two points in $XY-$coordinate we can compute the line equation using the following:

$\frac{y-y_1}{y_2-y_1}=\frac{x-x_1}{x_2-x_1}$.

If we have a gradient and a point, we can also compute the line equation using the following:

$(y-y_1)=m(x-x_1)$.

Of course, in a problem, we won’t get this information so easily. We have work a bit more to get either two points or one point and a gradient and then we are able to obtain the equation of the straight line.

Before I teach this course, I can only conclude that if you want to know the equation of a straight line you need to know either:
(i) two points, or
(ii) a point and gradient of the line.
But, actually there is a third condition, and if we know this condition, we can also compute the equation of a straight line. In the third condition, a line is assumed to be the tangent line of a certain circle. Thus, the characteristics we need to know to form a line are the radius of the circle and the angle between the radius and the positif $x-$axis. See the figure below.

In the figure, we can see that a line can be determined uniquely if the radius of the circle $n$ and the angle $\alpha$ are known. In the first section of this note, we shall derive how to define a line equation given these two conditions.
Suppose we have a straight line, $n$ are $\alpha$ are given. See the figure below. Consider the point $P(x,y)$. We are going to find the relationship of $x$ and $y$

The radius $n$, which is $|ON|$,  can be computed by adding $|OM|$ and $|MN|$. We shall consider $|OM|$ first. Consider triangle $OMQ$ which is a right triangle at $M$. We have the relationship:

$|OM|=|OQ|\cos \alpha=x \cos \alpha$.

Consider another triangle, $PM'Q$, which is also a right triangle at $M'$. We have the following relationship

$|PM'|=|PQ|\sin \alpha=y \sin \alpha$ as it can be computed that the angle $\angle PQM$ is also $\alpha$.

Therefore, we have $n=x \cos \alpha + y \sin \alpha$, which is the equation of straight line given that $n$ and $\alpha$ is known.

Before we discuss how to derive the formula to compute the distance between a point and a line, I would like to discuss how to find $n$ and $\alpha$ if we know the general equation of a straight line $ax+by+c=0$. Consider a line equation$ax+by+c=0$, then we move $c$ to the right hand side and multiple both sides with a non zero constant $k$$kax+kby=-kc$. We shall choose $k$ such that $ka=\cos \alpha$ and $kb=\sin \alpha$. Therefore, we have

$k = \pm \frac{1}{\sqrt{a^2+b^2}}$ and

our equation of line becomes:

$\pm(\frac{a}{\sqrt{a^2+b^2}}x+\frac{b}{\sqrt{a^2+b^2}}y)=\pm(-\frac{c}{\sqrt{a^2+b^2}})$.

Here, we have that the right hand side of the above equation is $n=\pm(-\frac{c}{\sqrt{a^2+b^2}})$, and we choose the positive value to get $n$. The angle $\alpha$ can also be computed once we determine $n$.

2. Distance between a point and a line

To compute a perpendicular distance between a point and a line, we shall use the above result. Consider a straight line $l:x \cos \alpha+y \sin \alpha = n_1$ and a point $P$ in the following figure.

We want to compute $d$. In order to do that, we need to make another line that is parallel to the line $l$ and passing through point $P$. This line, because it is parallel to $l$ and, has the following equation:

$x \cos \alpha+y \sin \alpha = n_2$

Thus the distance between the point $P$ and the line $l$ can be easily computed by considering the absolute difference between $n_1$ and $n_2$ as follow:

$d = |n_2-n_1|=|x_p \cos \alpha + y_p \sin \alpha - n_1|$

As we know from the first section that we can substitute the latter expression into:

$d = |x_p \frac{a}{\sqrt{a^2+b^2}}+ y_p\frac{b}{\sqrt{a^2+b^2}}-(-\frac{c}{\sqrt{a^2+b^2}} )|$

or

$d=\frac{|ax_p+by_p+c|}{\sqrt{a^2+b^2}}$

which is the same as the formula we mentioned in the beginning of our note.

Categories: Teachings Tags: , ,

My first Coursera course

In the middle of this year, I received a Fulbright Visiting Scholar that allowed me to go to Athens, OH, US. I spent four months in Ohio University starting in September, which means that I took a leave in the university I am working. One of my activities while I was in Ohio University was I took a course from Coursera. At that time I was eager to learn and to know python programming language therefore I decided to take the course, An Introduction to Interactive Programming in Python, offered by Rice University taught by the following professors: Joe Warren, Scott Rixner, John Griener, and Stephen Wong.

My first coursera was nothing but really, really good. The class could not definitely be better. The intructors have put so much effort in preparing the class and at the same time they were really enjoyable and fun. I really learned a lot from this class and I recommend everyone to take this class. After nine weeks, I finished the course and proudly said that I got 96.9% with distinction mark.

But what I wanted to tell here is the content of the course. From knowing nothing of Python I now know that the word ‘python’ is originally from the Month Python’s Flying Circus not the reptilia. I also know how useful this new programming language is. Python can be used to build an interactive game, to conduct some scientific computations, to analyse data science and many more. There are already many communities that use Python and they are (still) growing. One more good thing is the fact that it is free. Python works on either Windows, Linux or Mac and the installation on each device is not that difficult. I am using both Windows and Ubuntu. For Windows, I use mainly Python(x,y) and for Ubuntu, I don’t have to do anything as it is already inside. However, in this course, I did not have to use all of these as one of the instructors has built a nice Python web application that is called Codeskulptor. It will allows us to make a python scripts on your web browser so actually you don’t have to install python in your computer.

From the course, I learned to make interactive games. Even though the games I made were not perfect but I think it is playable and fun enough. I learned to make games like rock-paper-scissors-spock-lizzard, number guessing game, stopwatch game, pong, memory, and asteroids. The following links are the python scripts for all of the above games I made during the course. The link will bring you to a codeskulptor website, in which I had already written a python script. You just need to press the play button on the top left of your screen.

1. RPSLS  This game is called rock-paper-scissors-lizzard-spock game. It is an extention of rock-paper-scissors and first appeared in The Big Bang Theory series.

2. Number guessing game This game, as you might guess, is a number guessing game. The computer hide a number between a small number and a big number and you have finite tries to guess what number the computer is hiding.

3. Stopwatch This game will train your reflexes. It will show a stopwatch and you have to press the pause button every whole second.

4. Pong Oh, please tell me you know this game.

5. Memory There are 16 cards facing down, and all of them come in pair. Figure out the pair with the smallest number of tries.

6. Blackjack The blackjack game, yes, it is the blackjack game that you always know.

7. Asteroids Asteroids is an arcade space shooter game and I think I played this game when I was a kid. I played this game using an Atari device.

Other than those games, I made two another python scripts just for fun. The first is a fan and the second is the illustration of Hilbert’s curve. Hope you like it.

Categories: Justincase, python, Teachings

Files output in C++

All the programs that we normally use inputs from keyboard and give outputs on the screen. However, in a large scale computation, this situation is not effective. Thus, I have learnt how to produce outputs to a file, so that it can handle a large amount of data. I learned this back in 2007 and I have already forgotten about this code. Now, if I forget about this I know where to look.

Below I wrote a bit of source code that has to be compiled in C++. This program evaluates the exponential of a number from 0 to 3 using four different ways. The first three are using the Taylor polynomial of degree 1, 2 and 3 and the fourth way is using the built in exponential function from C++ itself. The output of this program is a file called “data.dat” that consists of five columns of numbers that can be used for plotting or other programs.

#include <iostream> #include <fstream> #include <cmath> using namespace std; double taylor(double x, int n); int factorial(int n); int main() { double number; ofstream out_stream; out_stream.open("data.dat"); for (number = 0 ; number <= 3.01 ; number = number + 0.01) { out_stream << number << " "; out_stream << taylor(number,1) << "\t"; out_stream << taylor(number,2) << "\t"; out_stream << taylor(number,3) << "\t"; out_stream << exp(number) << "\n"; } out_stream.close(); return 0; } double taylor(double x, int n) { double y=1; for(int k=1; k<=n; k++) { y = y + pow(x,k)/factorial(k); } return y; } int factorial(int n) { if (n <= 1) return 1; else return n*factorial(n-1); } 
I then used gnuplot to plot the output of the program. The plot is the following
where column 1 is the x-axis, while columns 2,3,4 and 5 are the evaluation of exponential of x-axis using four different ways. We can see that Taylor polynomials converge to exp(x).

(Another) Birthday problem puzzle

I’d like to discuss one of many birthday problem math puzzles. The complete puzzle and the solution can be found here. But let me write the puzzle as follows.

You and your colleagues know that your boss A’s birthday is one of the following 10 dates:

Mar 4, Mar 5, Mar 8
Jun 4, Jun 7
Sep 1, Sep 5
Dec 1, Dec 2, Dec 8

A told you only the month of his birthday, and told your colleague C only the day. After that, you first said: “I don’t know A’s birthday; C doesn’t know it either.” After hearing what you said, C replied: “I didn’t know A’s birthday, but now I know it.” You smiled and said: “Now I know it, too.” After looking at the 10 dates and hearing your comments, your administrative assistant wrote down A’s birthday without asking any questions. So what did the assistant write?

When I first read this puzzle, I am confused. Let me just name the reader/myself  “B” in the puzzle above to avoid more confusion. This puzzle is written in some way that the reader is part of the story. Hence the reader, B, was told the month of A’s birthday but we as the reader do not know the month of A’s birthday. Perhaps it is just a part of puzzle that we have to solve, therefore it might not be a big deal.

However, the big deal is the fact that the solution that I found is different from the solution given. I thought I might get wrong, therefore I look for the solution. What happened was I could not understand the solution. I thought it is just me but it turns out there is someone else who has the same experience.

I would like to modify a little bit of the puzzle in order to make this puzzle a bit clearer, well at least for me.

A’s birthday is one of the following 10 dates:

Mar 4, Mar 5, Mar 8
Jun 4, Jun 7
Sep 1, Sep 5
Dec 1, Dec 2, Dec 8

We then have the following conversations between A’s friend.
C said: “I don’t know A’s birthday, but I know only the day (the date) of A’s birthday,”
B said: “Well, I know only the month A’s birthday.”
C said: “Now I know it.”
B said: “Now I know it, too.”

From the information given above, can you tell what is A’s birthday?

Perhaps, this version is better than the previous one. What do you think?

Categories: math puzzle Tags: ,

Notes on diagonalizable linear operators

Okay, I have a few things in my mind about this topic and I don’t want to lose them tomorrow or the day after. Therefore, I created this note. Hope it is useful to other people as well. Background of this note are as follows:

1. Suppose $A$ is an $n \times n$ matrix and it is diagonalizable. Therefore, by definition, there is an invertible matrix $P$ and a diagonal matrix $D$. However, I always forget the relationship between $A$ and $D$, whether it is $D=PAP^{-1}$ or $D=P^{-1}AP$. Generally, those two are no different, but we can choose $P$ such that the column vectors of matrix $P$ are the eigenvectors of matrix $A$, hence we have to know precisely which one it is, otherwise it gets wrong. Until now, when I forget about this, I always derive it and it takes some of my precious time (haha) but now after I have this, I can just open the Internet and look for this note.
2. Point 1 above talks about diagonalizability of a matrix. But generally, we have a linear operator acting on a general vector field instead. A linear operator is called diagonalizable if there is a basis B such that the matrix representation of this linear operator is a diagonal matrix. It seems for me, diagonalizability of a linear operator and that of a matrix are talking about two different things. One is talking about how to find a basis, while the other is talking about how to find an invertible matrix. However, these two concepts turn out to be the same.

We begin with the following theorem.

Theorem 1 (Coordinate-change matrix)
Let $E$ be a standard basis and $B$ be another basis for an $n$-dimensional linear space $V$. Then there is an invertible matrix $P$ such that for every $v \in V$

$P (v)_B=(v)_E$.                                                                                                          (1)

Matrix $P$ is called the transition or coordinate-change matrix from the basis $B$ to the basis $E$. Note that $(v)_B$ and $(v)_E$ are the coordinates of vector $v$ with respect to basis $B$ and $E$ respectively. In fact, the column vectors of matrix $P$ are the coordinates of the basis vectors of $B$ with respect to the standard bases $E$ (i.e. if $B=\{ v_1,v_2,\dots,v_n \}$ then $P=[(v_1)_E (v_2)_E \dots (v_n)_E]$ ).

We won’t prove the theorem as it can be found in any linear algebra textbook. However, using this theorem we can relate the diagonalizability of a linear operator and that of a matrix.Suppose $T$ is a diagonalizable linear operator on an $n$-dimensional linear space $V$. Take $x \in V$ then let $y$ be $y=T(x)$. Suppose $E$ is a standard basis in $V$ and $B$ is a basis in $V$ that consists of independent eigenvectors of $T$.

Then we have the following.

(i) $(y)_E = [T(x)]_E = [T]_E (x)_E = A (x)_E$, where $A$ is a representation matrix of $T$ with respect to standard basis $E$.
(ii) $(y)_B = [T(x)]_B = [T]_B (x)_B = D (x)_B$, where $D$ is a representation matrix of $T$ with respect to basis $B$. We also know that $D$ is a diagonal matrix.

We want to show that using the theorem 1, $D=PAP^{-1}$ or $D=P^{-1}AP$. From equation (1) we get:

$P (y)_B = (y)_E = A (x)_E = A P (x)_B$.

Hence, we have $(y)_B = P^{-1}AP (x)_B$. While from point (ii) we have $(y)_B = D (x)_B$. As a conclusion, we have,

$D = P^{-1} A P$.

We have derived that in fact, $D = P^{-1} A P$ is the right one. We also derived that the invertible matrix $P$ has such a close relationship with the basis $B$ as the column vectors of $P$ are the basis vectors of $B$, which are the eigenvectors of the linear operator $T$. This conclude my note.

Categories: Justincase, Teachings

I first hear about this phrase in the Indonesian government of education website. Academic recharging is one of fund application schemes provided to academician who feels bored and sometimes tired doing teaching in their respective university. This scheme is provided to ‘recharge’ them in some way such that they are able to go abroad conducting research with their colleagues overseas. Indonesian government hopes by doing this scheme, lecturer and academician could update their knowledge to the current topics so that Indonesian academic society would not be left behind.

But I have found my way of academic recharging. And I give many thanks to ICTP and MIT. Courses that are provided by ICTP and MIT have been recorded and have been available online. I don’t know since when this happens but for me it is great. I can update my knowledge with some new information that I have never learned before.

After downloaded a video, I can watch the course that I am interested. When I don’t understand a thing, I can just pause and google them. I can pause anytime I want when some students knocking my door. I strongly recommended this way of learning to my colleagues and my students as this is much as fun as watching movie.

Here are some references that you might like.

Categories: i will do these, Teachings