Circuit Theory 2014 May – Teaching Summaries

  I start writing summaries for my daily teaching in UTAR and posted them in our dedicated Facebook group.

  I not really sure if the students will appreciate the summaries. But I do think* that they can use the summaries to recap what have been delivered in that the class while they are asleep. To me, these summaries can re-explain and re-clarify some concepts, which I have badly explained in class.

Continue reading “Circuit Theory 2014 May – Teaching Summaries”


Why 1+2 + … + n = n × (n+1) /2 ?

Still remember how to calculate the summation for 1+2+3+ … + 10 ? Well, the summation for the first ten sequence (starting from 1) is 55.

But, how do you calculate it? Pressing the sequence into calculator, one by one manually?

Fine. What if I change the question to 1+2+ …+ 1000. Probably, you will not bother to calculate this anymore.

Try to recall what you have learned in secondary school  — there is a formula!

1+2+3+ …+ n = n × (n + 1) /2

Perhaps, the math teacher had challenged you to add from 1 to 100, or to any suggested number and he could give you the answer in 5 seconds. Later, he disclosed the secret formula to you and the whole class laughing together and learned the secret formula.

So, why 1+2+3+ …+ n = n × (n + 1) /2  ?

Perhaps your math teacher just ask you memorize this secret formula (that why you have forgotten?). In fact, there are a few proofs to derive this formula. In the following, I will provide a simple example to derive the summation formula. Be noted that, this is just a simple illustration and it is NOT a complete proof.

Okay. Assuming we have 4 x 4 = 16 balls that are arranged as the following picture.


This balls topology can further be segmented to two triangles one rectangle.

So, the first triangle + the middle rectangle +right triangle balls = 16 balls. Note that we didn’t change the number of balls. We just represent 16 balls in different topology.
The left and the triangles are actually the same balls. So, they can be combined as “two triangles”.
Okay. We continue to move the second rectangle to the right. So, the right hand side becomes 4×4 – the rectangle.
Since the rectangle has 4 balls, 4 x 4 – rectangle becomes 4 x 3 (or, 3 x 4).
Now, we divide the left hand and the right hand sides by 2, and the “equation” becomes “one triangle = 4 x 3 /2”.
Note that the triangle is one ball + two balls + three balls. If we change all these balls to numbers, the equation becomes…
That is exactly 1 + 2 + … + n = n × (n + 1) / 2.
The example is taken from Joseph H. Silverman’s “A Friendly Introduction to Number Theory” 3rd Edition.

At the End of the Class

I never think I am good or have passion in teaching. But I do try to join the students in the journey in learning (though not every time success), have them enjoy the learning, try to convey something important other than the questions that may come out in the exam.

In the end of the class, I hope they have learned something good in life. I am sure they have bright future.

UEET2533 Information Theory and Coding (2014 January)

[Math is Fun] Why 0 cannot be divisor?

I remember my secondary teacher told me that 1 cannot be divided by 0.

Why 0 cannot be divisor?

“Because it is just not permitted in arithmetic”, he said.

Well. It is not permitted because it is not permitted. A kid shouldn’t ask much…

Throughout my N years of learning and teaching, I know that 0 cannot be a divisor because if it does, something will go wrong in mathematics. But how things can go wrong other than the calculator showing some error messages?

Here is a simple example.

Let say

  1 / 0 = SOMETHING,

is valid.

If so, I can multiply both left hand and right hand sides by 0.  And, it becomes

1 = 0.

Oops, something is wrong with the arithmetic. That’s why we can’t have 0 as the divisor.

Well. Perhaps you are not yet convinced and ask “how about 0 / 0 ? Since  a number divide itself always gives 1”.

Well, assuming

0 / 0 = 1,

is valid.

So, we can have a statement

2 = 2
2 = 2 x 1
2 = 2 x 0 / 0
2 = (2 x 0) / 0
2 = 0 / 0
2 = 1.

Wait. Something is wrong again. We can’t have 0/0 =1 then.

* The above examples are taken from Professor Steward’s Cabinet of Mathematical Curiosities by Ian Steward.

Living in Cloud with Samsung Chromebook

2014-01-17 12.02.11I always like to work on my stuff wherever I am. Perhaps this is due to my role as a PhD student and also an academic staff, or I am just addicted to Internet. I have an IPad for about two years. But most of the time I just can’t do things with IPad — I need a real keyboard with bigger screen.

My friends always take me as a weirdy when I take out my Samsung Chromebook in office or coffee shop. They always curious how I going to survive with this “Internet-oriented machine”. Generally, the Chromebook is not that popular in Malaysia as compared to IOS or Android tablet. Still, I find the Chrome OS (operating system to run the Chromebook) interesting and cool and bought it second hand in a good deal.

This is my experience with Samsung Chromebook after using it for about a month.


The Samsung Chromebook is light and has about 6 hours battery life. Additionally, the Samsung Chromebook has an impressing sleep function (standby mode) — it takes about 1 second to wake up from or go into the sleep mode. Imagine that you just need to open the lid to start you work and close the lid when you decide to go. No waiting needed.

Additionally, Samsung Chromebook has a comfortable keyboard and nice touch pad. I can scroll the browser with two fingers and switching the tabs with three fingers, etc..

Simulation Software

As a PhD student, I need to work on the computer software such as Python and Sage. Basically, I can run Python in Cloud9 (only one private project per free account) and Sage on its own web app. Nonetheless, I still prefer work my coding in the real machine instead of cloud because of the data safety issue — I feel insecure to leave my research work in cloud.

PDF Annotation 

Reading research papers is a must-do activity for a PhD student. Generally, the research papers are in the PDF form. We can read the PDF with Chrome browser or Google drive viewer. However, there isn’t much choice if we want to have annotate the PDF. Both PDFZen and Crocodoc provide free PDF annotation services. Basically, PDFZen is able to retrieve the PDF from Google Drive and store it back afterwards, but it is unstable after all. Comparatively, Crocodoc does not link with Google Drive — the user needs to upload the PDF manually to the website manually and download it back to Google Drive after the annotation. I prefer Crocodoc though it is not that convenient.

Preparing Research Paper

Most PhD students prepare their research paper with Latex rather than MS Word. I prefer the ShareLatex but WriteLatex seems to have a better interface. In fact, I still prefer to prepare the research paper with Lyx, a beautiful Latex word processor but it only runs in Windows and Linux.

Office Suite

My university uses MS Word a lot in official documents. I found Zoho Doc (link-able with Google Drive) handles the MS Word much better than Google Doc and Quick Office. Most of my lecture slides are prepared with LibreOffice or MS Office. Some of my meeting records and plans are prepared in Google Doc.

Brainstorming and Note Taking

I like Evernote. It is free and upgradable for better features and capacity. I use it a lot for brainstorming ideas.

Research Meeting with Hangout

Hangout is a chatting app, something like Skype. And, it is fun. You can video call your friend with some entertaining effect in the video.


Perhaps Samsung Chromebook is just an Internet browser machine. Like Pirillo said, “I bought it for what it is, and not for what it is not“. There are still room of improvement for the apps and I am concerning on the safety of the data stored in cloud. Other than these, Chromebook is a good cool machine and I enjoy using it.

Insync – Bringing Google Drive to Linux

Google Drive

I am quite a happy Google users for most of the time. I enjoy most of the Google products, e.g. Gmail, Nexus, etc. but not really for Google Drive.


Google Drive is the Google’s cloud storage service, where users can store their files, music, whatever digital file to the cloud for free. The service has been released since 2012 and it is available for Windows and Mac users but not for Linux users.

Perhaps it is because only 2% Linux users in the population? It sounds irony when we found that Google has been working on Linux (Android and ChromeOS are Linux for quite sometimes.

Perhaps there are too many Linux operating systems in the market that cause the issues of incompatibility and hassle? I don’t think so as Dropbox (another free cloud storage service provider) has released its Linux client since years ago. They can do it, why can’t Google?

Perhaps Google is just reluctant to do so?

Continue reading “Insync – Bringing Google Drive to Linux”

Linux Mint Maya KDE – Hibernation Issue in Dell Vostro 3450

Hibernation is a must-have feature in a laptop. I can work on my programming, then hibernate the machine in 30 seconds, take a nap and resume the machine to the state before it hibernates in 30 seconds and continue my work — I can just continue my work from I stop seamlessly. However, the hibernation function seems to be missing in Linux Mint Maya (KDE) in my Dell Vostro 3450. The followings are the patches to overcome this issue.

The patches include:
1. Prepare the scripts to hibernate.
2. Make an hibernation icon in the start menu.
3. Solve the noisy fan issue (due to the hybrid card) after resume from hibernation.

Continue reading “Linux Mint Maya KDE – Hibernation Issue in Dell Vostro 3450”

Solving Simultaneous Equations with Python

I own a very old fashion scientific calculator and it can’t solve any simultaneous equations like those new calculators (not even 2×2!). The situation goes worst when I try to do my Circuit Theory tutorial, in which I need to solve many simultaneous equations. Can’t I just concentrate on forming the equations and let someone to solve them for me?

Well! Let the Python do it!

All you have to do is forming the proper equations. Then, fire up the following script. Key in the proper coefficients of each equation when Python asks.

Please feel free to copy and use it anywhere you like.


import numpy as np

print 'How many variables ?'
print '>> ',
total_variable = int(raw_input())

# User key in all the variable numbers

equation_list = []

for i in range(total_variable):
    print 'Please enter the coefficients of the #%d equation.' % (i+1)
    print 'For example: (1)*x0 + (2)*x1 = (3) ---> "1 2 3"'
    print '>> ',
    user_input = raw_input()
    user_token_str = user_input.split()
    assert (len(user_token_str)== (total_variable +1))
    user_token = [float(u) for u in user_token_str]

equation_arr = np.array(equation_list)

# A * X = Y
# Given A and Y, we need to find X.

Y_arr = equation_arr[:, -1:]
A_arr = equation_arr[:, :-1]

print 'Y_arr:' , Y_arr
print 'A_arr:' , A_arr

X_arr = np.linalg.solve(A_arr, Y_arr)

print 'Answer:'
for i, x in enumerate (X_arr):
    print 'x%d value: %f' % (i, x)