A Manifest for better University Teaching in Math

The Current State

Teaching at the university level is completely different from teaching in schools. We assume that adults are capable of autonomous, self-guided learning. Thus we teach by „reading“ to them. In math, that is writing on a blackboard. Students are expected to make notes to conserve our wisdom for their studies at home. In math, this means copying every word, formula, and figure from the blackboard, carefully avoiding transmission errors and possibly correcting the errors we make on the blackboard.

Simple copying is a boring, time-consuming, and inefficient way to learn. 

The old-timers often disagree. They argue that it has a learning effect, especially if it is followed by preparing a careful summary at home, something that only very few students do and only in their favorite subjects. Nowadays, students have to be present about 20 hours a week and cannot be expected to spend the same time to prepare summaries, and then the same amount of time again for solving exercises.

The truth is that most university teachers are too lazy to prepare each lesson separately. So they reproduce the same script year after year. A minority does indeed prepare the lesson mentally with the result that they talk and write at the same time, but with different content. This is a most common mistake with slides. Note:

When using slides you must read aloud everything that is written on the slide!

Otherwise, your audience will be reading and not listen to you.

Blackboards do not foster this mistake in the same way as slides, because you have to turn your back to the audience while writing, and it feels strange to talk without eye contact. Some do it nevertheless. But yet you are easily tempted to talk and explain while the students still copy your content from the blackboard. You should always remember that you have just uncovered your writing by stepping aside from the blackboard. The following is very obvious.

When using the blackboard be silent while the students copy from the blackboard!

Since we are talking about the current state and the mistakes that are done in teaching we should become aware that the times are changing. Be aware that after the Bologna process the universities changed drastically. When I studied math I took two subjects, such as topology and probability theory. In these subjects, I had to pass a final examination with no grading. The other subjects in my secondary subject I did not take too seriously. They had to wait until I prepared for the final examination, sometimes all at once in one written test.

Nowadays, it is not uncommon to have six subjects at the same time, like complex functions, algebra, numerical math, an introduction to statistics, and two classes in the side subject. All these modules have tests at the end of the term, and all must be passed and are graded. The grades usually go into the final grade of your degree.

Students have less time for your class than you think.

Most modules in our university have 5CP with 4 hours of presence. The semester has 30CP, so that adds to 24 hours of presence. You need a bit of time to learn or do exercises. I would say you need at least another 18 hours just to keep up with the subject. So you should not be surprised if students do not spend as much time on your subject as you expect.

We also have classes with 10CP in the first semesters and 6-7 hours of presence. This is much better. But even then this is only 1/3 of the total amount of studying. So students can only spend two full days on your subject, almost one day completely taken by copying your content from the blackboard.

Towards better Teaching

The first change would be to have fewer subjects at the same time. There is simply no way a student can learn a lot of different math subjects at the same time in any sustainable way. The student will concentrate on a few of them, maybe one or two. It might be yours that is neglected!

The number of graded exams should be limited to two or three in each semester.

There might be one or two more subjects but they should not be graded and the exams should be very easy. And in no way should they count for the final grade.

This concentration of fewer exams can actually be achieved by collecting modules from several semesters into one bigger module in one semester. The problem is often to organize this, i.e., to make room for larger modules. The staff that is responsible for organization finds it easier to squeeze small modules into the available space. We should not let them do this.

Math takes time and concentration on one subject without too much distraction.

The next step is not to waste the time of your students. If you write your script onto the blackboard and they have to copy it from there in the class this process is simply a waste of time. Students do not think while they write. If you want to get the feeling for this process go into a research talk and write down everything that appears on the blackboard, or even worse, on the slides. Do that while the speaker is explaining what he just did and try to split your attention to reading, writing and listening. Research talks are not meant to be written down verbally. Some take notes, but nobody writes down all presented content. So why are you expecting your students to do just that?

Have a script available for the students and explain it in the class!

By explaining I mean any communication that is not written down by the students. It is about looking, thinking, imagining and if possible discussing. It may include small sketches or mind maps. The important thing is that it is activating the process of reflection on the subject. One of the best ways of doing this is by connecting it to previous knowledge or experience. In any case, these explanations are not meant to be written down and read later. For this, we use the script.

I have done classes without a script and actually am doing one right now. I am completely aware and ashamed of doing so. As a lame excuse, this is not one of the classes I do on a regular basis. Moreover, I try to cope with this defect by carefully waiting until the blackboard content has been copied. Only then I start to explain what I did and encourage the students to think and reflect on what they just saw. Moreover, I give them time to recover while I carefully clear the blackboard. The good side effect is that I do not cover an excessive amount of details. It is still enough since this class is one of the rare modules with 10CP.

You and the students should know what you expect your students to accomplish.

Do you expect your students to study every detail of every proof you give? That is exactly what many teachers do. Of course, it is not possible to achieve this completely. Consequently, the process of learning is a frustrating thrive for perfection. The argument behind this ambitious goal is to keep the standards as high as possible. Asking for less sounds like giving in to the „mediocre students of today“. But this attitude does not work and hinders the students from becoming true mathematicians.

Use the exercises to make your goals as clear as possible!

You should set clear goals for your students. These should be goals they can reach. So, device exercises that actually are possible to do. Do not underestimate the positive motivation of a goal that has successfully be mastered and the negative impact of a thrive for perfection which is impossible to reach. In fact, it is not possible to completely master a subject in math. Luckily, there will always be some open question in our subject, even on an „elementary“ level.

Get the students interested in the interesting math that is not covered in your class.

The part of the subject that you have covered in your class should be a good basis, but it is never complete. Make that clear! And make clear that you expect the basics to be mastered, and that those basics are covered in the exercises that you gave. You can add exercises that you do not expect to be solved but by one or two students in your class. You expect the students to understand and try these problems to practice their persistence. These exercises should be clearly marked, however.

In the same way, you might extend your class to subjects which are not covered in the exam. Make clear that you do this because these subjects are interesting. Make sure that they really are. Be aware, that the students will only accept this if they get the feeling that they can actually accomplish the subjects that are part of the exam. Otherwise, they will claim that you are wasting their time with unnecessary stuff which just confuses them.

The Future

The future has already started. We now have the internet. It has its good and bad sides. Usually, we tend to completely ignore the net. We argue that its content is not reliable enough. In view of our own background, it is not surprising that we want the students to use books and research papers. But these limits are no longer appropriate. Restricting students to printed material is wishful thinking.

Be aware of the Internet!

In the net, you will find academies with thousands of videos about all topics in math. Many of them are actually very well done and enjoyable ways to learn a topic. The idea of the academies or the virtual universities is „self-guided“ studying. You can stop a video or a presentation and repeat it at any time. No doubt do we meet problems. Some videos, even by high-class universities, are actually very bad. But so are the classes, to begin with, and they do not get better by recording them. The purpose of a video in the net can only be to design teaching on a very high level and make that public. It takes effort and time to do this.

There is also material like scripts and exercises publicly available in abundance. Clearly, this material might not always meet the requirements or follow the presentation of the attended class. But students tell me that with a bit of search they always find something that helps them better understand my teaching. I have no quarrels with that.

Use the net for social interaction!

This is what young people today are used to. Social media is by far the biggest part of the net, and the most attractive. You can view that as an extension of learning groups or student meetings. Sadly, is it often also a replacement for the actual being-together of people. But for us teachers, it is a chance that we just are beginning to explore. Currently, I use our platform only to present material like exercises, scripts and code snippets, and occasionally links. It is a one-way communication. The students have their own meeting points.

This ends my „manifest“ towards a better teaching of math. This blog does not get many comments. But it may be worth to discuss a little bit about the teaching of math in the comments. You are welcome to do so!


14. Juni 2018 von mga010
Kategorien: Uncategorized | Schreibe einen Kommentar

The „One More Ace?“ Problem

Let me tackle another problem of statistics. I found it on a web page among other problems of the silly kind like „Is 0.999..<1?“. But actually, this one is a real problem that can provide insight into statistical thinking. It is elementary though. I am going to use Euler Math Toolbox (EMT) for some calculations and simulations.

Assume we have a set of Bridge cards (52 cards with 4 colors from 2 to 10, J, Q, K, Ace). This is dealt to four players, each player getting 13 cards. Answer the following two questions.

  1. Assume one player gets an ace of any color. What is the probability to get a second ace?
  2. Assume one player gets the ace of spades. What is the probability to get another ace?

My take on this is the following guideline:

Device a repeating experiment that mimics your problem!

In this case, we deal the 52 cards „randomly“ over and over again. We assume that every deal has the same probability. And I assume that you know that there are

\(\displaystyle \binom{52}{13} = \frac{52\cdot\ldots\cdot40}{2\cdot\ldots\cdot13} = 635’013’559’600\)

possible ways to select 13 cards from 52 cards. We have assumed that all of these deals come with the same probability. The frequentistic approach is to assume that we deal each distribution with the same frequency on the long (very long) run. So we can just assume we deal each one exactly once, and get our probability (the expected ratio of „good cases“) by

probability = „number of good cases“ / „number of all cases“

For problem 1, „all cases“ are the cases where there is one ace, and „good cases“ are the cases where there are two or more aces.  For problem 2, „all cases“ are the cases with the ace of spaces and „good cases“ the cases with the ace of spades and another ace.

We are then faced with counting, a problem of combinatorics. In this case, we can count the result. In other cases, there is only the option of a Monte-Carlo simulation. Let us do one in EMT.

>function simulate1 (N) ...
$  c=1:52; n1=0; n2=0;
$  loop 1 to N
$     c=shuffle(c);
$     k=sum(c[1:13]<=4); 
$     if k>=1 then
$         n1=n1+1;
$         if k>=2 then n2=n2+1; endif;
$     endif;
$   end;
$   return n2/n1; 
$  endfunction

EMT may be an easy language to do the programming, but it is not the fastest one. And it is easy only if you know the basic syntax of a matrix language. E.g., the command c[1:13]<=4 returns an array b of 13 zeros and ones (where we simulate the four aces by the numbers 1 to 4). Its element b[i] will be one if and only if c[i]<=4. Summing up we get the number of elements in the first 13 shuffled cards that are smaller or equal to 4. In the code, n1 is then the number of times where one ace showed up and n2 the number times where two showed up.

It is important to note that we discarded all shuffles with no ace in the first 13 cards. It is like a condition in Bayesian reasoning. We are asking for the probability that there are two or more aces under the condition that there is one ace.

The change for the second problem is only in one line. We have to check if a specific ace (say the number 1) is in the array.

>function simulate2 (N) ...
$  c=1:52; n1=0; n2=0;
$  loop 1 to N
$     c=shuffle(c);
$     k=sum(c[1:13]<=4);
$     if any(c[1:13]==1) then
$         n1=n1+1;
$         if k>=2 then n2=n2+1; endif;
$     endif;
$   end;
$   return n2/n1; 
$  endfunction

The function any() returns 1 if any element of the argument is non-zero. Since c[1:13]==1 tests for the elements to be equal to 1 (the ace of spaces) we get the right answer.

As you see, the outcome of the experiment is quite different. This is why the problem is interesting.

Now we want to do the combinatorial job of counting and computing the probabilities. We expect our simulations to get „close“ to the „correct“ probabilities. The mathematics behind this is very basic combinatorics. My feeling is that this kind of reasoning should be in the mathematical class of any higher education. If you do not know the result you should learn it.

The number N(k) of deals for player number 1 which contain exactly k aces is as follows.

\(\displaystyle N_k = \binom{4}{k}\binom{48}{13-k}\)

The reasoning behind this is as follows: We have to select k from the 4 aces, and 13-k cards from the 48 cards that are no aces. If we do this we get all possible selections with 13 cards that contain exactly k aces.

Finally, the probability in problem 1 is („good cases / all couting cases“)

\(\displaystyle p_1 = \frac{N_2+N_3+N_4}{N_1+N_2+N_3+N_4} \approx 0.3696\)

as computed by EMT with

>function N(k) := bin(4,k)*bin(48,13-k)

This is close enough to our Monte-Carlo simulation.

Note that N(2:4) returns the array [N(2), N(3), N(4)] automatically in a matrix language. This works since the function bin() „maps“ to elements of array arguments. The sum of N(0) to N(4) is the number N of all deals. This allows a simplification with a new insight.

\(\displaystyle p_1 = 1 – \frac{N_1}{N-N_0} = 1 – \frac{a_1}{1-a_0}\)

where a(k)=N(k)/N is the probability to get exactly k aces. Of course, 1-a(0) is the probability got the one or more aces. So the right-hand side is what we expect as the probability for our Problem 1. If you are not as frequentistic as I am you may have come up with this formula immediately.

Let us tackle the Problem 2 now. This is even easier. We are now only dealing with 51 cards (all but the ace of spades), and we deal only 12 cards. It is easy to count the number of deals with none of the remaining aces. The answer is

\(\displaystyle p_2 = 1 – \frac{\binom{48}{12}}{\binom{51}{12}} \approx 0.56115\)

This should now be obvious (after some thought), and our simulation was close enough to this.

So the probabilities are indeed different. This seems counter-intuitive at first thought. But let us try to find a good argument.

Let us look at the complementary probabilities 1-p(1) and 1-p(2). In both problems, we then have to divide the number of times we have exactly one ace („bad cases“) over the number of times we have at least one ace („all counting cases“). But both numbers change between Problem 1 and 2. The bad cases in Problem 1 are simply 4 times the bad cases in Problem 2. But the counting cases in Problem 1 are less than 4 times the counting cases of Problem 2. It is not 4 times as likely to have any 3 aces than to have the ace of spades plus any two aces. Since the numerator is smaller, 1-p(1) is larger, and p(1) is consequently smaller.



04. Juni 2018 von mga010
Kategorien: Uncategorized | Schreibe einen Kommentar

A Problem on Probability

I just found an old problem in Spiegel Online (see here). The problem is absolutely mind-boggling. It goes as follows.

Three prisoners A, B and C are told that two of them will come free on the next day. You are prisoner A. You cannot stand the waiting time and ask a guard to tell you the name of one of the prisoners who will not come free, but not your name, of course. The guard says: B will come free. Now, what is the chance that you will come free too?

The impulsive answer is 1/2. After some thought, it is 2/3 again. Or maybe it is still 1/2? There are good arguments for both. And does „probability“ make any sense at all?

The decision about the two lucky prisoners has been made before A asked, hasn’t it? Asking does not change the chance. So it is still 2/3, assuming that the two prisoners are chosen at random with equal probabilities among the three. Right?

If you have decided in favor of 2/3, I change the question a bit to confuse you. Assume, it was 10 prisoners and 9 become free. After you ask the guard, he sets 8 of them free. You are alone with the last one and claim that the chance for both of you to get free is 9/10. Would you think this is a sensible claim?

To confuse a bit more assume that the guard is free to say any name. He says A. Now what is the meaning of you saying that your probability to become free is 2/3?

What makes this problem hard to treat is the notion of „probability“. For me, probabilities make sense only if there is an experiment going on. I am what they call a frequentist. Now, what could be the experiment in this case? Clearly, it is the selection of the two prisoners by an external force. Without further knowledge, A is among the selection with probability 2/3, i.e., in 2/3 of the cases on average.

The important question is if the knowledge that B is among the selected prisoners changes our experiment. We can argue that it does. The options that A/C are selected is no longer possible. We have only two options left, A/B and C/B. So in 1/2 of the possible outcomes of our experiment, A will come free. What this tells us is that the probability for A to come free is 1/2 provided we know that B will come free.

But does this change of our experiment (discarding A/C) really reflect what is happening in the problem? This can only be clarified by studying the exact question in the problem.

In the online journal, the question was formulated carefully: Does it make sense for A to ask? Will he know more after he gets an answer?

And this is not a question we can answer without assumptions. The reason is that it depends on the preference of the guard in the case B/C. If he does not select to say B or C with equal probability A does indeed know more after asking. But if he does A cannot gain any further knowledge. Our chance is still 2/3.

Let me elaborate that. We start our experiment by selecting 2 of the 3 prisoners. A is among the selected with probability 2/3. Now we ask the guard. In the B/C case, we assume the guard says B with probability p. Now a bit of thinking shows that he will say B in 1/3+p/3 of all outcomes of our experiment, and C in 1/3+(1-p)/3.

  • Assuming he says B, A will be set free in (1/3)/(1/3+p/3) = 1/(1+p) of these cases. For p=1/2 this is 2/3 as expected. For p=1 it is 1/2.
  • Assuming he says C, A will be set free in (1/3)/(1/3+(1-p)/3)=1/(2-p) of these cases. For p=1/2 this is 2/3 again. For p=1 it is 1. Indeed, if the guard always says B in the case B/C, we know for sure that we get free if he says C.

As always, the problem turns out to be more complicated than it appeared at first sight.

For those of you who still think this is rubbish and the probability must be 2/3 to get free because the selection has been made beforehand, I have good news. You are also right!

Let us compute. A comes free in 1/(1+p) of the cases where the guard says A, and he says that in (1+p)/3 of the cases. A does also come free in 1/(2-p) of the cases where the guard says B, and he does so in (2-p)/3 of all cases. If you add all the cases where A gets free you end up with 2/3.

We have just fine tuned our knowledge about the chances if the guard says B or C. In the case p=1/2, the result is quite easy. The guard will say B or C with probability 1/2, and A gets free in 2/3 of the cases, no matter if the guard says B or C.


13. Februar 2018 von mga010
Kategorien: Uncategorized | 2 Kommentare

A Geometry Problem with Three Circles and a Point



I friend gave me a geometric problem which turns out to boil down to the figure above. We have three arbitrary circles C1, C2, C3. Now we construct the three green lines through the two intersection points of each pair of these circles. We get lines g11, g12, g13. These lines intersect in one point. Why?

As you know, the argument for the middle perpendicular lines on the sides of a triangle goes like this: Each middle perpendicular is the set of points which have the same distance to two of the corners. So if we intersect two of them in P then d(P,A)=d(P,B) and d(P,B)=d(P,C), which implies d(P,A)=d(P,C). As usual, d(P,A) denotes the distance from P to A. Thus P is also on the third middle perpendicular. Note that we need that P is on the middle perpendicular on AB if and only if d(P,A)=d(P,B).


A similar argument is possible for the angle bisectors. These rays are the set of points with equal distance to two sides. For the heights, such an argument is not available. The standard proof goes by constructing a bigger triangle where the heights are middle perpendiculars. By the way, this proof stops working in Non-Euclidean hyperbolic geometry, where the fact still holds.

Can we make up a proof similar to these proofs for our problem? It turns out that this is indeed possible. The correct value is the following:

\(f(P,C) = d(P,M_C)^2-r_C^2\)

where r(C) is the radius of the circle C, and M(C) is its center. To complete the proof, we only need to show that the line through the intersection of two circles C1 and C2 is the set of all points P such that f(P,C1)=f(P,C2). Then the proof is as easy as the proofs above.

There are several ways to see this.

We could use a result that I call chord-secant-tangent theorem which deals with products of distances of a point on a secant or chord to the circle. But it is possible to get a proof using the Pythagoras only. In the image above we have

\(d(P,Q)^2+d(M,Q)^2 = d(P,M)^2, \quad d(S,Q)^2 + d(M,Q)^2 = r^2\)


\(f(P,C) = d(P,M)^2 – r^2 = d(P,Q)^2-d(S,Q)^2\)

where C is the circle. Now, if we have two intersection circles, the right-hand side of the equation is the same for both circles, and thus also the left-hand side.


We have seen that f(P,C1)=f(P,C2) for all points on the green line.

But we have to prove the converse too. For this, we observe that D(P,C1)=D(P,C2) implies that P is on a circle around M(C1) and on another circle around M(C2). The two circles meet only in points on the green line.

There is also another way to see that f(P,C1)=f(P,C2) defines the green line. If you work out this equation analytically, you see that it is equivalent to an equation for a line. I leave that to you to check.

Note that there is a second situation where the result does hold too.


In this case, we need f(P,C) for P inside C. It will be negative, but f(P,C1)=f(P,C2) still holds for all points on the line through the intersection, and even if P is on the circles.

There is the following special situation.


It can be seen as a limit case of the previous situation. But it can also be proved by observing that all the tangents have the same length between the intersecting point and the tangent point.

Here is another situation.


The green lines are the sets of points such that f(P,C1)=f(P,C2) for two of the circles. It is quite interesting to construct these lines. I leave that to the reader.



25. Januar 2018 von mga010
Kategorien: Uncategorized | Schreibe einen Kommentar

Jauch und Mathematik

Ich kann nicht glauben, dass der Bericht so vollständig stehen bleibt:

„Auch bei der folgenden mathematischen Frage musste Scherbaum sich helfen lassen: Ein Kreis mit einem Umfang von 3.141,6 Metern hat einen Durchmesser von ziemlich genau …? A: 100 Metern, B: einem Kilometer, C: zehn Kilometern, D: 100 Kilometern. Scherbaums Telefonjoker? Passenderweise ein Mathelehrer. Doch dann der Super-GAU: 29 Sekunden entfleuchte dem Pädagogen kein einziges Wort. Kurz vor Abbruch der Verbindung dann ein entspanntes: „Schwer zu sagen“. Danke für Nichts! Ein betagter ehemaliger Physik-Student aus dem Publikum wusste mit B dann aber doch die richtige Antwort.“

Ein zweiter „Mathelehrer“ hatte dann nach diversen Berichten die richtige Lösung parat. Peinlich ist schon, wenn der Kandidat das nicht wenigstens abschätzen kann. Aber jemand, der irgend etwas mit Mathematik zu tun hatte und seine Nerven halbwegs zusammen hat, sollte das leicht wissen. Ich kann mir das nur durch hochgradige Aufregung erklären.

09. Januar 2018 von mga010
Kategorien: Deutsch | Schreibe einen Kommentar

Povray and Euler

I found a nice plot by Taha on my Google+ page. It uses a software called MathMod. Euler Math Toolbox can do this too teaming with Povray.

>load povray;
>t=linspace(0,1,100); s=t';
>b=cos(2pi*s)*(t+0.01)+t; c=sin(2pi*s)*(t-0.01); a=t;
>X=cos(2pi*a)*(b+0.1); Y=sin(2pi*a)*(b+0.1); Z=c;

This is all that is needed to generate the following spiraling tube.

Spiral-001Let me explain.

First of all, the pov…() commands generate text snippets which model graphical elements in the syntax of Povray. These text elements are written to a file by writeln(). The commands povstart() and povend() simply open and close the file and start the Povray interpreter. The output of this interpreter is then inserted into the notebook window of EMT.

For an example of such a Povray snippet, let us try the following.

 box { <0,0,0>, <1,2,3>
  texture { pigment { color rgb <0.0627451,0.564706,0.0627451> }  } 
  finish { ambient 0.2 } 

This is a green box with side lengths 1,2,3.

The povgrid() command finally is able to draw the surface as a grid. We use the skip= parameter to skip most grid lines from drawing, but still get a smooth appearance of the grid.

The coordinates for the mantle surface of the tube are X,Y,Z. These three variables contain matrices. Thus X[i,j],Y[i,j],Z[i,j] is one point on the surface. To compute these matrices, we use the matrix language of EMT. First, s and t are two vectors, a row and a column vector with values from 0 to 1. Then we generate a cylindrically shaped surface with coordinates a,b,c.

>t=linspace(0,1,100); s=t';
>b=cos(2pi*s)*(t+0.01)+t; c=sin(2pi*s)*(t+0.01); a=t;
>for i=1 to 3; writeAxis(0,1.2,axis=i,c=lightgreen); end;


This cylindrical surface is then wrapped around the z-axis (point upwards). The details are a bit involved. But any mathematician should be able to understand what is going on here.

08. Januar 2018 von mga010
Kategorien: English, Euler | Schreibe einen Kommentar

Journalists and Logic

The „Zeit“ titles „Die größte bekannte Primzahl ist gefunden“, in English „The biggest known prime number has been found“. The logic of this heading is so bizarre! The article is not saying much anyways.

06. Januar 2018 von mga010
Kategorien: Uncategorized | Schreibe einen Kommentar

A Geometric Problem

I found the following problem on my Google+ account: In the image below, the total length of the blue line segments is equal to the total length of the green line segments. The segments form an angle of 60° among each other.


After a while of thinking, I found a nice proof of this phenomenon. It is probably the standard proof, and it also yields a lot of generalizations.

We assume the black dot at (0,0) in the plane and denote the direction of the green line segments by vectors by v1, v2, and v3, all of them with length 1. Then


If we denote the lengths of the green segments with a1, a2 and a3, we have that

\(a_1v_1, \quad a_2v_2, \quad a_3a_3\)

are the endpoints of the segments. Now, let c be the center of the circle. We thus have

\(\|c-a_kv_k\| = \|c+b_kv_k\|\)

for k=1,2,3 if we denote the lengths of the blue segments with b1, b2, b3. Squaring this and using a bit of vector algebra, we get

\(– a_k (c \cdot v_k) + a_k^2 = b_k (c \cdot v_k) + b_k^2.\)

Here, the dot denotes the scalar product of two vectors. Thus

\(a_k – b_k = c \cdot v_k\)

Summing up for k=1,2,3 we get our conclusion

\(a_1+a_2+a_3 = b_1 + b_2 + b_3.\)

This generalizes to finitely many vectors which sum up to 0. E.g., we can take the sides of the following pentagram as vectors.


The corresponding result can be seen in the next figure.


Of course, a special case is 10 line segments with equal angle 36° between them.


31. Dezember 2017 von mga010
Kategorien: Uncategorized | Schreibe einen Kommentar

Least Common Multiplier of First N Numbers

There is a famous result that is quite surprising if you see it the first time: The log of the least common multiplier of the first n integers is approximately n. The quotient converges to 1. Or to say it another way: It’s n-th root converges to e. You will find this result in the net. It is equivalent to the theorem about the distribution of prime numbers.

Let us check that with software.

>&lcm(makelist(n,n,1,500)), &log(float(%))/500

Of course, this infinite integer arithmetic of Maxima is not an effective way to check the result. Instead, we can use the following code to get the quotient for much higher numbers.

>longest sum(f*log(p))/N

This is based on the following observation. To compute the least common multiplier of 1  to n, we have to compute

\(p_1^{k_1} \cdot \ldots \cdot p_m^{k_m}\)

for all primes p(i) less then n, where k(i) is the largest number so that

\(p_i^{k_i} \le n\)

The logarithm of this product is exactly what is computed in the code above. If we make this a function and compute it for N from 10 to 5000, we get the following graph.


30. Juni 2017 von mga010
Kategorien: Uncategorized | Schreibe einen Kommentar

Translating a Sage Example for EMT

The nice Sage Math project is something I am very interested in. It is a rather complete package for mathematical computations based on Python. If you are interested in open source math this is probably one good way to start. I must add however that I prefer open source packages directly based on Python with a command line (like IPython) instead of a web based interface that covers everything with another layer. The advantage of the latter is, of course, that it may provide additional services, e.g., for cooperation.

On Windows you will have to run Sage Math in a Virtual Box. You can then open the web interface in your normal Windows browser and work there.

I will certainly come back in this blog to Sage Math. For a start, let me translate an example of Sage Math into Euler Math Toolbox (EMT). It is an example for the famous Lotka-Volterra equations, representing the relation between predator and prey. As far as I can tell, Python uses a fourth order Runge-Kutta method to solve the differential equation numerically. The equations themselves are written in symbolic form. The package contains features for symbolic computations.

### Simulates Lotka-Volterra population dynamics, producing a vector field
### Arrows indicate the direction of population evolution
### The blue contour is one potential stable loop
var('t R F R0 F0 a b c d')
a = 0.04         # rabbit birthrate
b = 0.0005       # probability of predation per encounter
c = 0.1*0.0005   # rabbit -> fox conversion efficiency
d = 0.2          # death rate of foxes
R0 = 5000     #initial number of rabbits
F0 = 200      #initial number of foxes

de_R = (diff(R,t) == a*R - b*R*F)
de_F = (diff(F,t) == c*R*F - d*F)

end_points = 500
stepsize = 1.0
steps = end_points/stepsize
ics = [0,R0,F0]
des = [de_R.rhs(), de_F.rhs()]

sol = desolve_system_rk4(des,[R,F],ics,ivar=t,

## Clean up to graph
sol_t=[]; sol_R=[]; sol_F=[]
for i in range(steps):

a = plot([],figsize=[6,4])
a += line(zip(sol_R,sol_F))
a += plot_vector_field((des[0], des[1]), (R,0,7000), (F,0,225),
a.axes_labels(['Rabbits','Foxes']); show(a)

I entered that as is into the Sage Math browser and the following plot was produced. I had to copy the image out of the browser, because I have no idea on how to save the image with the browser interface. Let me also note that I do not understand every command above, though many of them are self explanatory.


Let us translate this too Euler Math Toolbox. We use the numerical side of EMT only, although we could have defined some functions in symbolic form. But it would not help much to do so.

>a=0.04; b=0.0005; c=0.1*b; d=0.2;
>R0=5000; F0=200;
>function dR ([R,F]) := a*R-b*R*F;
>function dF ([R,F]) := c*R*F-d*F;
>function f(x,y) := [dR(y),dF(y)];
>{x,y}=vectorfield2("dR","dF",min(s[1]),max(s[1]),min(s[2]),max(s[2]), ...
>   scale=0.005,<plot); 
>plot2d(s[1],s[2],color=blue, ...
>   xl="Rabbits",yl="Foxes");

The result is the following, very similar, plot. However, the anti-aliasing is better, but that could be due to my lack of knowledge in Sage Math.


31. Mai 2017 von mga010
Kategorien: English, Euler | 2 Kommentare

← Ältere Artikel