## Category Archives: Practical math 实用数学

#### Degrees and angles | 角度

Today in the fourth grade weekend lesson we learned about angles📐 and degrees. We explained what degrees was first🥇 because angles are classified using degrees📏. Degrees were discovered by Egyptians. They invented the degree symbol ° and also came up with the 360° circle⚪.  There is an interesting history of how they connect the movement of the Sun with time.   They first divided a year into 360 days, noting that the Sun moved in a circle. Around 1500 BC Egyptians divided 24 hours⏳, though the hours varied with the seasons originally. Then the Greek astronomers made the hours equal. About 300 to 100 BC the Babylonians subdivided the hour into base-60 factions: 60 minutes an hour and 60 seconds in a minute.

We use degrees to measure angles. An angle is a figure formed by two rays🛴 called sides of the angle. In geometry there are three types of angles: an acute angle between 0 and 90 degrees, right angle a 90 degree angle, and an obtuse angle between 90 and 180 degrees. In 1936 a clay tablet was found buried at Shush (Khuzestan region of Iran🌏) some 350km from the ancient city of Babylon on which was inscribed a script that was only translated as late as 1950. The text provided confirmation that the Babylonians measured angles using the figure of 360 to form a circle. The Babylonians knew that the perimeter of a hexagon was exactly equal to six times the radius of a circumscribed circle. This is why they chose to divide a circle in 360 parts⚪. If we did not discover degrees or angles we would not be able to build anything properly🧱. So if we tried building a house without degrees or angles the house would collapse🏚.

We will talk about triangles next time.

#### Welcome to our New Google Classroom!!😃

Hello everybody!😃 Welcome back to Magic Math Mandarin.  Since we are staying home because of covid-19, we brought our classes to google classroom so our students can keep on learning even during this pandemic👩‍🏫. Now we can all communicate with each other online💻. In this classroom we will be learning Chinese🈷, math➗, and programming👩‍💻. Our teachers will put new assignments everyday about each topic.  If you would also like to join our wonderful classrooms then here is the class code mtxl6j4

#### Credit and debt in the world | 信贷和债务 xìn dài hé zhài wù

This weekend’s financial math class started big: we looked at all the credit (money lend out as loans) or debt (money borrowed) from around the world.🌎🌏🌍

At any given moment, there are hundreds of trillions of debt or credit. You can “have a look” at All of the World’s Money and Markets in One Visualization from Visual Capitalist.  The information was from 2017, but you get the sense.

Debt (or credit) can be categorized in 4 groups: government, household💳, financial sector and non-financial companies.💰💶💴💷💵💸

We looked at the United States government debt in previous classes.   You can check the numbers from the Treasury Department.  The link is easy to remember too: treasurydirect.gov/NP/debt/current

You can get the numbers of other countries from IMF (International Monetary Fund), the World Bank, and some other organizations.

A company called Visual Capitalist summed up the government debts from all the countries, the number is \$63 Trillion!😲🤑

This means that the US government debt is one third of the world’s grand total government debt.🗽

#### Mobile payments | 移动支付

This weekend’s financial math class is all about payments, in particular, mobile payments and mobile wallet💰.

Mobile wallet 移动钱包 are digital forms of wallet that people carry (or used to carry) in their pockets.  As we do not tend to carry large amounts of money in wallets, mobile wallets are convenient for small payments (as opposed to payments in larger businesses).

📳 They hold digital information about payments including credit and/or debit card, bank account, pre-paid card, virtual currency information, coupons and loyalty membership, and wallet holder identifications.📟

A mobile wallet is a software application (app) 💻that does the following:

• Securely store user information such as phone number, email address, and mailing address

The flow chart below summarizes the history of technology and events that evolve over the last eighty years.

In China and many places around the world 🌎, mobile payment is accounting for most of the retail payments.   So you should know about how it works.  Next class we will talk about the math that goes into making mobile payment secure.

#### Wealth distribution | 财富分配 💲

We went onto a journey of wealth discovery in this weekend’s math class.  We played with real world data from the Federal Reserve .

We spent the first five minutes just looking quietly at the chart below, and tried to understand its meaning.  Hint: read legends and labels.

The area chart shows the time series of total wealth of 4 buckets of US population.

The buckets are defined as 1st percentile, 90th – 99th percentile, 50th – 90th percentile, and the bottom 50% percentile of population by wealth.   In other words, if all the people in the US are ranked by wealth, the top 1%, and the top 90% to 99%, …, and the last 50%.

Source: Federal Reserve

The remainder of the class is discussion on what the chart means.

Kudos to Emily.  She was quick to point out that the red area of the chart is as thin as a line, and that’s all the wealth of the bottom 50% of Americans.

While the rest of the people are having more and more wealth overtime, the bottom 50% seem to have less and less, relative to the rest.

So is the world fair place?  No.

Some questions for the class to think about:

1. How to make the world more fair?
2.  Can the world be more fair?
3.  Should the world be more fair?
4.  What does fair mean?

#### Digital currency | 数字货币

Today in class we talked about money and how they are transacted.

Two acronyms we introduced are “DC” and “EP”, meaning Digital Currency and Electronic Payment.

An important piece of recent financial news that you might have missed is that the Chinese central bank (央行） has issued its own digital currency, saying that its design is similar to Facebook’s proposed cryptocurrency Libra.

❗Digital currency is a big deal.

It not only affects how people go about their daily lives, but also world politics.

For example, we know that the United States sanctions certain countries by blocking them from the banking system.

❓ But what if these countries and the rest of the world start to use digital currency as the world currency instead of relying on the US dollar?

That would be really bad for the US, unless we become the leader in this space and catch up where we have fallen behind.

For the young, it is time to learn how DC and EP work.

#### Decision trees | 决策树 jué cè shù

Today, we focused our class on decision tree. Decision tree is a way to organize data.   You can look at it this way: you ask a bunch of questions and make a bunch of decisions, and organize data based on these decisions.

For example, if our data consists of colors and shapes of 3 pieces of fruits. We have 1 yellow apple, 1 red apple and a yellow banana. We have two features: shape and color.

By organizing our data, we can identify types of fruit. We go through our data on shape and color one by one. If we first organize our data by color, we know that will incorrectly group the yellow apple with the yellow banana. But if we first organize our data by shape, that will right away group apples and banana separately. So we organize this data by shape, and then by color (if we want to make a distinction between yellow apple and red apple).

The way to organize data may be (highly likely) different for another dataset of fruits. But you get the point: we organize data to best group things. In each step of the way, our data gets more organized. The “energy distribution” has become lower entropy.

That was a classification tree model.

When we have lots of decision trees for different random parts of a larger data, we have the so-called “random forest” 随机森林 model, originated by Leo Breiman.

We showed in class how to code a decision tree from scratch.  Here is a shorter version using Python sklearn library.

```# making up data
>>> training_data = np.array([
>>>     [1, 1],
>>>     [2, 1],
>>>     [1, 0],
>>> ])

# Yellow = 1, Red=2
# round =1, oblong = 0
>>> from sklearn import tree
>>> data = np.array(['Apple','Apple','Banana'])
>>> data_names= ["color", "shape"]
>>> fruit_names = ['Apple', 'Banana']
>>> clf = tree.DecisionTreeClassifier()
>>> clf = clf.fit(training_data, data)
>>> tree.plot_tree(clf.fit(training_data, data))

# visualize tree
>>> import graphviz
>>> dot_data = tree.export_graphviz(clf, out_file=None)
>>> graph = graphviz.Source(dot_data)
>>> graph.render("fruit")
>>> dot_data = tree.export_graphviz(clf, out_file=None,
...                      feature_names=data_names,
...                      class_names=fruit_names,
...                      filled=True, rounded=True,
...                      special_characters=True)
>>> graph = graphviz.Source(dot_data)
>>> graph.render()
```

#### Entropy | 熵 shāng

Nothing is lost, nothing is created, everything is transformed.
― Antoine Lavoisier (August 1743 – 8 May 1794)

Unlike before, we started the class today with a quote. This is because it is really difficult to talk about entropy, and we made many analogies (such as water flows from high to low, a mirror broken never, or almost never, returns to whole again) to bring our attention to how things work in daily life that we have taken for granted.

Some theory/hypothesis says that the universe started with Big Bang, a state with very low entropy. There are many states of high entropy than low entropy (imagine 10…000 to 1). So we will have to cycle through lots of high entropy states before it is low again. Well, we only have barely touched the topic. Whereas our true goal is to talk about the so-called decision tree model, which we will cover tomorrow.

To help you remember the word “entropy” and its meaning (as if we knew!), “en” comes from “energy”.  “tropy” means “transfom”, and comes from Latin.

Entropy is a measure of the number of possible ways energy can be distributed in a system.

By the way, Lavoisier 拉瓦锡 was a great chemist.

#### Tycho Brahe and Johannes Kepler | 第谷·布拉赫 和 约翰尼斯·开普勒

In today’s class we deviated from our normal computer work and went in further on one of the stories told by Terence Tao in the “Cosmic Distance Ladder” video.  This particular story was about Tycho Brahe and Johannes Kepler.

It was a very important story of data and analysis.

Tycho Brahe and Johannes Kepler had totally disparate backgrounds and temperaments.

In spite of this, Tycho’s painstaking and detailed observational data of the planet Mars, combined with Kepler’s mathematical genius, allowed Kepler to derive the three laws of planetary motion. Both Tycho Kepler’s 3 Laws of Planetary Motion and Kepler made significant contributions to the change in the prevailing world view of a geocentric universe. It was the beginning of a systematic study that transformed Medieval thinking – alchemy became chemistry and astrology led to astronomy.

https://chandra.harvard.edu/edu/formal/icecore/The_Astronomers_Tycho_Brahe_and_Johannes_Kepler.pdf