The white lion | 白狮子

Today in class we talked about the story called “The White Lion”.    The young minds remember and tell that story so well.

The story is about a little white lion.

The story began in a dark night where the white lion and his big brother were waiting for their mother to come back with dinner.  They were small cubs.    The brother of the white lion went to see if their mother was close by.

But a snake bit his brother and ate him.  The little white lion ran as fast as he could from the snake.  He got lost so he just climbed a tree to rest in for the night.  Meanwhile in a village close by villagers were running out of food. The villagers sent a boy to go to the woods to look for food.
More

秋天好 | Autumn is good

Do you like fall?  We talked about autumn (qiū)(tiān) in this weekend’s Chinese lesson.

(qiū)(tiān)(dào)(qiū)(tiān)(hǎo)
(lán)(lán)(tiān)(kōng)白(bái)(yún)飘(piāo)
(bǎo)(bǎo)(tái)(tóu)(hā)(hā)(xiào)
magic math mandarin

Fall is here.  Fall is good.
Blue sky and white clouds.
The baby looks up and laughs.

Besides 中文, we are also working with other organizations to help children with computer programming 编程.

极客星晨少儿编程

zero, one and two | 零,一,二

It is not easy for a young child to comprehend multiplication by 1, as how they are taught in school is often the robotic multiplication table.   She or he can very quickly answer mutiplications by 2, or 3.    Because of this, questions like “what is the product of 1,2, 3, 4” (i.e. 4 factorial) can get a wide range of answers because the number “1” confuses the young mind.

Pychologist says that an infant learns the number 2 before the number 1.   And we can see why: with 2, there is something to compare against, like two fingers.  If there is only one finger, there is no variation, it is confusing.

When we teach multiplication, don’t forget to show that math is an integral part of the real world around us.   It is invented to simplify addition.  Multiply by 1 means just the thing itself.  Multiply by 2 means adding two of this thing together.  Multiply by 3 means adding three of the thing together.  The thing can be a bag of candies or the footage of a home.

Finally, we should show children how to use computers (not calculators) to do computations.   While a question like “give me the sum from 1 to 199” can be solved within seconds with math tricks, a slightly different question “give me the product from 1 to 199” won’t work with the same trick.  But if you know how to make the computer do the job, you can still answer it within seconds.

 

Logarithm | 对数

As we had explored in previous classes, division is subtraction again and again and again, multiplication is adding again and again.  Exponentiation is multiply again and again and again— They are all inventions to simplify repeated computation.

So is the invention of logarithm: taking log is division again and again and again.   They were invented by John Napier who was a Scottish mathematician, physicist, and astronomer  in 1614 as a means to simplify calculations.

🙂 Today’s  Python numpy class summary:

Log10 means how many times divide by 10 will return you to 1. log10(100) will give you 2 because 100 divide by 10 twice returns us to one.
>>> np.log10(100)
One trillion divide by 10 twelve times returns it to 1.
>>> np.log10(1000000000000)

>>> np.linspace(0.0, 3.0, num=4)
Out: array([0., 1., 2., 3.])

>>> np.logspace(0.0, 3.0, num=4)
Out: array([   1.,   10.,  100., 1000.])

>>> np.linspace(0.0, 12.0, num=13)
Out: array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10., 11., 12.])
>>> np.logspace(0.0, 12.0, num=13)
Out: array([1.e+00, 1.e+01, 1.e+02, 1.e+03, 1.e+04, 1.e+05, 1.e+06, 1.e+07, 1.e+08, 1.e+09, 1.e+10, 1.e+11, 1.e+12])

Bonus:  Did you know that Engineers and scientists used to use a tool called “slide rule” (计算尺) to do logarithmic computations until 1970s when electronic computer and calculators came into use.  You should go and check it out if any of your grandparents have one of these.

Find if something is also somewhere else (contd) | 找一找那里是不是也有

Today’s class we continued the game of finding matches.  We expanded from numbers to names.

Let’s pretend that there is a room out there that has the following famous people:

room1 = pd.Series([‘Grace Hopper’, ‘Albert Einstein’,’Michael Faraday’,’Emmy Noether’,’Ada Lovelace’])

And another room with these famous people:

room2 = pd.Series([‘Isaac Newton’, ‘Thomas Edison’,’Mary Somerville’,’Matilda’,’Ada Lovelace’])

These two rooms are in building:

building = pd.concat([room1, room2], axis=1)

building.columns= [‘room1′,’room2’]

             room1            room2
0     Grace Hopper     Isaac Newton
1  Albert Einstein    Thomas Edison
2  Michael Faraday  Mary Somerville
3     Emmy Noether          Matilda
4     Ada Lovelace     Ada Lovelace

Now we want to find a list of people “who” in the building and the rooms.

who = np.array([‘Albert Einstein’,’Michael Faraday’,’Ada Lovelace’])

Are they in room 1?

np.isin(who, room1)
Out: array([ True,  True,  True])

Are they in room2?

np.isin(who, room2)

Out: array([False, False,  True])

Are they in the building?

np.isin(who, building)
Out: array([ True,  True,  True])

We are constantly comparing things.  How to compare is a very tricky and interesting subject.  You should look up the source code of the function in1d and see how it does it.

Count non-zeros using numpy.count_nonzero | 数非零数

Today our class practiced making the computer count number of non-zero numbers using the numpy library from Python.  This can be useful if you have a ton of numbers.

import numpy as np; import pandas as pd

some_array = np.array([[0,1,7,0,0],[3,0,0,2,19]])

array([[ 0,  1,  7,  0,  0],
[ 3,  0,  0,  2, 19]])

np.count_nonzero(some_array)

5

np.count_nonzero(some_array,  axis=0)  Count across the rows, i.e. count along the column

array([1, 1, 1, 1, 1], dtype=int64)

np.count_nonzero(some_array,  axis=1)  Count across the columns, i.e. count along the row

array([2, 3], dtype=int64)

We talked about this example:

d = {'Basket1': [3, 0], 'Basket2': [3, 4]}
df = pd.DataFrame(data=d, index=['Apple','Chips'])

# Count the number of non-zeros across the rows
pd.Series(np.count_nonzero(df, axis=0), index=df.columns.tolist())

This was the result we got.

Basket1    1
Basket2    2
dtype: int64

That was a very tiny data. If we have a dataset with a million rows and columns, we should definitely do this!

python numpy basics | 基础 python numpy 1

Tonight our class played together numpy basics and math.  We put together a numpy basics notebook:
https://nbviewer.jupyter.org/github/magicmathmandarin/PythonBasics/blob/master/numpy_basics1.ipynb#back-to-top

Programming by trial and error is a great way for kids to learn not only programming but also math. — this should play a bigger and bigger role in children’s day to day learning.  玩编程也帮助学习算术。

Somehow I have a feeling that learning long division in this day and age is wrong.  在这个时代还学长除法那就不对了。

Go ahead and tinker with the code in the notebook. Nothing will break, we promise 🙂

Chinese style education & empty basketball courts |中国式教育和空荡荡的蓝球场

I was in China this November to conduct surveys on education.  I had a few chances of sitting in some after school education programs and cram school classes, including XDF新东方, and was shocked by the amount of work Chinese kids have to do and was saddened by the way they are learning.

Let’s talk about the amount of work first.   I saw very few kids out and about any time of day except commuting hours.   Basketball courts are empty, even on weekends.   Where are all the kids?  They are in endless cram school 补习班 classes.

A middle school child routinely gets up before 7 am and does not go to sleep until midnight or after.   Middle school students stay in school until 8 pm, and work on additional homework from 8 pm till midnight.   Younger students are often working similar hours.
More

Innovation in education | 教育创新

We don’t hear about startups in education in America as we hear about them in other industries. Why? There are multiple reasons. One is the belief that superior education and profit making are conflicting.  Are they?

Superior customer service in other industries seems to lead to higher profit. People don’t have any issues with that. Then why with education?

It shouldn’t.

So why?
More

Do more for real intelligence | 为真人智慧加油

The word AI (artificial intelligence) is everywhere these days. Some of the best young minds are pouring into the field, and industry need is so dire that graduate schools can hardly keep PhD students until graduation.

In the craze of the artificial, real intelligence seems to have been forgotten. Here, the word “real intelligence” means intelligence from real human being.
American k-12 education continues to go downhill regardless of funding, more and more homeless people in New York City are begging in the streets (many are young and able), and millions of prime age citizens are not looking for work where many jobs are left unfilled.
More