Trump’s Tariffs Maths

Liberation Day was a monumental day for exposing the mathematical skills of the Trump administration. Matt Parker and others already made videos that explain the ludicrous maths. I would like to go a step further and try to work out the last bits of ambiguity of what the Trump administration actually did with the numbers.

They showed a complicated formula:

$$\Delta \tau_i=\frac{x_i-m_i}{\epsilon*\varphi *m_i}$$

This formula is clearly Mathiness, an approach to make their calculations look more complex and trustworthy than they really are. The actual calculation comes down to:

$$t=\frac{\text{exports-imports}}{\text{imports}}$$

We now have the starting point for calculating the tariffs (t). We only need imports and exports per country. The US Census provides this information, and you can download its data. Trump only posted the poster boards with some numbers, but the Guardian published the full list. I downloaded the list from here, but it contained an error for Reunion.

We now have to make some slight modifications since imports and exports can be considered from the perspective of the USA or the foreign country. Moreover, we need to have the deficit expressed as a positive percentage number. So for the data from the US Census, this comes to:

$$t=\frac{\text{exports-imports}}{\text{imports}} \times -100$$

There are a few more rules we have to consider:

  • All trade surpluses are ignored, resulting in a default of 10%.
  • The reciprocal tariff is set to the rounded half of the trade deficit percentage, but no lower than 10%.
  • If the trade deficit percentage is an uneven number, then one is added before it is halved.

This results in the following table that you can also download as a CSV file. There are a couple of odd choices that I still cannot explain. For this purpose I calculated the deltaTarif column to show the difference between my calculations and the official data.

Afghanistan, for example, has a trade deficit of 49%. This should result in a reciprocal tarif of 25%, but they only get 10%. Some countries are off by one, such as Vietnam. They should have 45% but got 46%. Same problem with Japan (24% vs 23%).

Lying in the chart of what the numbers mean and then presenting a misleading formula is just terrible. If you want to be evil, be at least good at it.

CountryNew US tariffsTariffs charged to the USAIYREYRdeficitFractioncalcTariffdeltaTariff
Afghanistan104922.58835911.44678849.3243931549-15
Albania1010128.280409141.727893-10.48288207100
Algeria30592461.6111421014.50410958.78698745590
Andorra10103.3692494.911141-45.76367018100
Angola32631869.239166682.35286963.49568951630
Anguilla10101.19059872.488329-5988.396671100
Antigua and Barbuda101023.75155573.765998-2315.699178100
Argentina10107092.1611699170.997286-29.31174387100
Armenia1010121.583116160.78363-32.24174153100
Aruba101010.704668725.539495-6677.786056100
Australia101016685.5098434593.34854-107.3256908100
Azerbaijan1010157.776472255.07449-61.66826826100
Bahamas10101792.3730195639.742401-214.6522705100
Bahrain10101204.3409221646.230202-36.69137799100
Bangladesh37748365.7663272213.96414273.53542933740
Barbados101048.564639772.603153-1490.875931100
Belize101081.128498590.448355-627.7940176100
Benin101048.623404216.446069-345.1479148100
Bermuda101023.328268540.382525-2216.427971100
Bhutan10103.2810483.427734-4.470705701100
Bolivia1020504.146695401.03642120.45243478200
Bosnia and Herzegovina3570179.08958452.98845670.41231834700
Botswana3774405.123674104.32745674.24799816740
Brazil101042316.3236249666.97632-17.37072617100
British Virgin Islands101060.246807312.909554-419.3794818100
Brunei2447238.849306127.21327146.73910796470
Burundi10103.7366846.61399-77.0015875100
Cabo Verde10104.48299912.246976-173.1871232100
Cambodia499712661.80682321.62958397.45984449970
Cameroon1122248.80528193.06434422.40343774220
Cayman Islands101049.399551286.490024-2504.254541100
Central African Republic10101.42202735.070359-2366.223145100
Chad132680.81403859.93985525.82989728260
Chile101016469.4799618167.7934-10.31188262100
China3467438947.3861143545.739567.29773453670
Christmas Island10101.7472422.11479-21.03589543100
Cocos (Keeling) Islands10101.1006442.58047-134.4509215100
Colombia101017690.3489619037.61341-7.615816097100
Comoros10101.8483914.738928-156.3812527100
Cook Islands10100.8921196.861175-669.08742100
Costa Rica101711634.905339676.78815216.82967866100
Djibouti101040.11125144.982858-261.451857100
Dominica10102.30619558.79899-2449.610506100
Dominican Republic10107505.43083813081.66107-74.29593789100
Ecuador10128524.3062637531.65375311.64496534100
Egypt10102546.0001416092.022475-139.2781672100
El Salvador10102311.2127914556.353458-97.14123579100
Equatorial Guinea1325127.64078895.37969125.27491212250
Eritrea10100.85291837.475441-4293.791783100
Eswatini101022.58860946.113517-104.1450051100
Ethiopia1010465.8443351017.706562-118.4649432100
European Union2039605760.3933370189.230438.88850535390
Fiji3263259.27247394.67957163.48259809630
French Guiana10101.82112928.999681-1492.401252100
French Polynesia101040.42327145.19757-259.1930341100
Gabon1010171.666854171.0651050.350533016100
Gambia10101.96989780.563522-3989.732712100
Georgia1010165.4141711736.461692-949.7659792100
Ghana10171171.728486967.30454317.44635771100
Gibraltar10100.431179650.596519-150787.8027100
Grenada101014.074818165.335817-1074.692397100
Guadeloupe10103.427661470.637794-13630.5817100
Guatemala10105019.8924129714.801951-93.52609884100
Guinea10106.179835138.336186-2138.509378100
Guinea-Bissau10100.1228483.394912-2663.506121100
Guyana38765375.488661314.9305375.53840008760
Haiti1010616.7707851214.423999-96.90037669100
Heard and McDonald Islands10100.0135890.058879-333.284274100
Honduras10105532.5617217057.473677-27.56249334100
Iceland10101072.626837985.8449218.090597122100
India265287416.4485841752.6679752.23705762520
Indonesia326428084.7378810202.0957263.67387952640
Iran10106.21849190.84743-1360.924041100
Iraq39787422.2753811660.55421277.62742385780
Israel173322217.4848514792.0349633.42164939330
Jamaica1010361.3725792644.127532-631.6901408100
Japan2446148208.566679740.8455546.1968715461
Jordan20403364.8772932030.7849539.64757781400
Kazakhstan27542330.749421077.09717153.78751736540
Kenya1010737.305128782.524079-6.13300373100
Kiribati10100.8081624.220009-422.1736484100
Kosovo101034.01594649.388369-45.19181386100
Kuwait10101643.605752411.831329-46.74025867100
Kyrgyzstan101016.66837133.144912-698.7878359100
Laos4895803.32015540.38529394.97270263950
Lebanon1010257.571987541.421719-110.2020974100
Lesotho5099237.2576852.79451398.82216123990
Liberia101072.529569220.400195-203.8763335100
Libya31611465.562558567.22043761.29674343610
Liechtenstein3773243.7205266.0408972.90302433730
Madagascar4793733.21549353.40721192.71602803930
Malawi173441.0546126.94073134.3783049340
Malaysia244752534.8479627704.7508347.26405062470
Maldives10104.76528992.612024-1843.471298100
Mali10105.50027851.496789-836.257931100
Marshall Islands101020.448963127.426248-523.1428361100
Martinique10102.807758199.161662-6993.263095100
Mauritania10102.854898139.755555-4795.290655100
Mauritius4080234.51991147.9910479.53647526800
Mayotte10101.889711.8176093.815453165100
Micronesia10102.4400950.489582-1969.168842100
Moldova3161136.49516753.62968360.7094638610
Monaco101047.589664162.798791-242.0885489100
Mongolia101026.97744396.615463-1370.174572100
Montenegro101015.38230627.681345-79.95575566100
Montserrat10105.63179412.071251-114.3411318100
Morocco10101904.8844415268.646115-176.5861278100
Mozambique1631216.070589149.69844730.71780491310
Namibia2142275.225098160.50649841.68173645420
Nauru30592.2389240.91669659.05640388590
Nepal1010120.461589120.890203-0.355809685100
New Zealand10205617.0425624499.42396219.89692241100
Nicaragua18364622.3255392940.98516136.37433936360
Niger10108.30669443.252222-420.6911679100
Nigeria14275699.1759594174.29826726.7561083270
Norfolk Island29580.1911650.08094457.65752099580
Norway15306583.334174592.03961830.24750834300
Oman10101319.9915291954.270075-48.05171337100
Pakistan29585123.656162135.14710658.32766604580
Panama1010555.82047210702.13406-1825.465973100
Papua New Guinea101579.15069867.2002215.09838612100
Paraguay1010356.1529573158.414426-786.8140398100
Peru10109363.19276111223.8033-19.87153942100
Philippines173414177.628129297.31312934.42264776340
Qatar10101834.1857273804.248139-107.4080113100
Reunion101044.06685611.88352273.0329706373-27
Rwanda101030.23841644.757797-48.0163412100
Samoa10105.71767454.397476-851.3917023100
San Marino101025.23302980.023469-217.137784100
Saudi Arabia101012733.7251613177.01009-3.481188132100
Senegal1010235.125168350.866605-49.22545638100
Serbia3774814.350544209.8591174.2298803740
Sierra Leone101028.74785119.859059-316.9322541100
Singapore101043203.722946032.64597-6.547868746100
Sint Maarten1010101.535218753.934338-642.5348099100
Solomon Islands10101.34589913.147232-876.8364491100
South Africa306014655.786595818.99893260.29555359600
South Sudan10100.80520259.276702-7261.718178100
Sri Lanka44883015.585462368.21457587.78961566880
Sudan101013.13389156.610929-331.0293804100
Suriname101090.91341383.542932-321.8771818100
Switzerland316163425.318624961.9869260.64349779610
Syria418110.6514682.02082681.02772313810
Taiwan3264116264.026942336.8614263.58558829640
Tajikistan10104.63393856.83741-1126.546622100
Tanzania1010204.714855573.380041-180.0871686100
Thailand367263328.1802217719.2494972.01996106720
Togo101089.996365283.59244-215.1154383100
Tokelau10100.1775850.295764-66.54785033100
Tonga10102.84524619.909723-599.7540107100
Trinidad and Tobago10123325.8779712939.68473811.61176797100
Tunisia28551123.215612503.58821555.16549008550
Turkey101016745.6640615292.979698.674988135100
Turkmenistan101014.59058582.234419-463.6128983100
Turks and Caicos Islands101010.983629713.57661-6396.728995100
Tuvalu10100.2244470.570424-154.1464132100
Uganda1020132.618139106.2928519.85044369100
Ukraine10101186.4982931683.510839-41.88902327100
United Arab Emirates10107474.43262426969.30898-260.8208186100
United Kingdom101068084.4683379941.34275-17.41494751100
Uruguay10101228.8341521649.000113-34.19224314100
Uzbekistan101042.437585380.795484-797.3071488100
Vanuatu224413.6670217.60105944.38393707440
Venezuela15295987.8627774232.02193529.32333134290
Vietnam4690136561.155813098.1551290.40857919901
Zambia1733169.112021113.76294132.72924046330
Zimbabwe183567.83311843.78274635.45520641350

Introduction to LEGO Train Automation

Many traditional model train sets feature advanced computer-controlled automation. The LEGO company still has to reach this level of sophistication. But we can always rely on dedicated AFOLs to fill the gaps. This post will introduce some of the solutions available in the market. The goal is to find the right combination of hardware and software to achieve your train project. I have been able to control four trains on what continues track without crashes.

Trains

There are many original LEGO trains available, but there are even more interesting ones available from alternative brands/resellers. Just have a look at BlueBrixx’s train section. It comes down to your taste on what exact train model you prefer.

Train controllers

More critical are the train motors and train controllers. After all, you want to control the train(s) remotely. The most popular approach uses Bluetooth to communicate with the train controller. The Powered Up Bluetooth HUB train controller and motor are the obvious choices for this approach. Alternatively, you can use the Technic Hub or the Spike Hub.

But there are other options. You can also use the SBrick Plus to control LEGO Power Functions train motors. You can also use Mindstorms as your controllers. For example, you can use the EV3 with a custom cable. Or you can build your own train motor engine.

Tracks

The original LEGO tracks are the go-to choice for many, but there are other legitimate options. Bluebrixx sells their own tracks at a much better price. They are not the only ones. There is also Modbrix, Trixbrix and 4DBrix. Some of the less common tracks are produced using 3D printers. You can also just download the 3D fiels and print them yourself.

You can of course, also visit Aliexpress to get a large variety of cheap tracks. The number of different designs availale is just amazing. LEGO is again falling behind.

Switches

You do not only want to control your trains but also the track itself. You can build an automated switch with original LEGO bricks. You will connect these switches to LEGO hubs that you can then control just like the trains. 4DBrix offers a complete automation system that also includes motors that are mounted on top of your original LEGO switches.

Sensor

To control the train, you need to know where they are on the tracks. You can add sensors to the train, such as a light sensor or a distance sensor. You can then place markers on the tracks, such as colourful plates (light) or walls (distance). The sensor depends on what controllers you use. The sensors typically originated from the different versions of Mindstorms. While driving over the marker, the train senses this information and can act upon it. You need a programmable hub, such as Mindstorms, to process the sensory input and act accordingly.

Alternatively, you can mount sensors to the track itself. This can again be original LEGO sensors (light or distance) or you can use 4DBrix’s sensor in combination with their whole system.

Controllers

If you use a distributed architecture, then you need the train controllers to communicate with the track controllers. At least one of them needs to be programmable so that it makes decisions. Alternatively, you can use a computer as a central controller that communicates with all components in your train system. This can be done wirelessly (Bluetooth, Infrared, or Wifi). Other systems, such as the 4DBrix System, use wires for all track-mounted sensors, switches and actuators. Alternatively, you can consider the MattzoController system, but it does require more knowledge in programming micro controllers. Anopther option is the TrixBrix system, but I am not sure how much it can be programmed.

Software

You will need software to make all the decisions in your train system. Based on sensory input from your train or track sensors your trains need to start/stop. Also, switches need to be triggered, booms lifted and decouplers triggered. The 4DBrix system uses the nControl™ software running on a computer to plan and program your train system.

The Brickrail software is based on PyBricks to program hubs/controllers. Another option is the Brick Automation Project, although it does not seem to have been updated in a while.

Computer

Depending on what controllers you choose, your computer needs to have USB, WiFi and Bluetooth. The latter is a bit more tricky than normal. You specifically need a Bluetooth Low Energy Dongle that integrates all Bluetooth LE features. If your computer does not have it built in then you need an external dongle.

New HRI Podcast episode

My sabbatical allows me to focus on the HRI Podcast. Here is another episode:

The One About Ethics

Robots are not just machines. We treat them as if they were somewhat like humans, including applying moral standards and expectations to them. Our behavior towards robots matters. The way we treat them reveals much about ourselves. In today’s episode, we will talk about how being nice is not the opposite of being cruel to them. I invited Bob Douglas and Mary Blossom from the AI Research Institute to introduce us to the topic. They agreed to produce a short podcast dialogue to get us started. I then discussed their introduction with Michael-John Turp and Minyi Wang.