# How to Determine the Relative Smartness Level of a City | Hacker Noon

To determine the relative smartness level of a city, there are several indicators that have been defined to arrive as such a number. These indicators, among many others, are:

• Natural Environment,
• Water and waste,
• Transport,
• Energy,
• Economy,
• Education,
• Health,
• ICT and
• Governance

In the swamp of these unbalanced indicators lies a mathematical law which is common to them all. It is called as Kleiber’s law.

## Background

Kleiber’s Law was found by scientist Max Kleiber, who was a Swiss mathematician doing his undergraduate studies in Zurich in 1910. He moved to California to study agriculture at the University of California Davis. He started his research on the metabolism rates in animals which was important to determine how much food the animals would require and how much meat they would produce.

It was then he stumbled upon a mysterious pattern that would be found in almost all of the animals. It was called as “negative power quarter scaling”. If mass vs metabolism was plotted on a logarithmic scale, the result was a perfectly straight line that was common to all animals.

The equation was clear, metabolism scales to mass to the negative quarter power. If you take square root of 1000, it is almost 31, and square root of 31 is almost 5.5 . If a cow that weighs 1000 times as much as a bird, the cow will live 5.5 times as long as a bird, and the heart rate would be 5.5 times slower than that of a bird.

Physicist Geoffery West decided to apply Kleiber’s law to the largest (mimicking) organism on the planet, cities. Did they obey it? Did they slow down as they expanded in size? His team conducted a research and found that cities did follow this law.

Number of street lights, gas stations, length of roads, electricity used by the city, all these indicators followed Kleiber’s law, which was found in biological life. They also found that a city that was 10 times as bigger than another was not 10 times more innovative, but 17 times more innovative. A city 50 times bigger was 130 times more innovative.

West proved that similar to animals, as cities get bigger, they slow down. But, they generate ideas faster than a smaller city. This is called as super linear scaling. Now, we are going to see it in action. The code used in this article can be found here

## Applying Kleiber’s Law

Now that we are familiar with Kleiber’s law, i will now apply it to the cities of today.

I have gathered data (source) for several different cities for 3 indicators, street lights, road length and electricity. The data in it’s raw form looks like this.

``````City Name, Length of Roads (in km), Population (100k)
Davanagere, 1278.7, 4.5``````

The data for electricity and street lights is in the same format.

After some cleaning and aggregating, I then calculate log to the base 10 of length of roads and log to the base 10 of the population. The code is

After aggregation the data looks like this:

``````City Name  Length of Roads (in km)  Population  RoadLengthPerCapita  RoadLengthPerCapitaLog  PopulationLog  LengthOfRoadsLog
2   Davanagere                 1278.700        4.50           284.155556                8.150537       0.653213          3.106769
4    Jalandhar                 2360.000        8.62           273.781903                8.096883       0.935507          3.372912
0     Belagavi                  979.670        4.88           200.752049                7.649271       0.688420          2.991080
8       indore                 3477.577       20.00           173.878850                7.441939       1.301030          3.541277
3      Gwalior                 1732.000       10.70           161.869159                7.338684       1.029384          3.238548
5       Jhansi                  731.575        5.07           144.294872                7.172876       0.705008          2.864259
7      Namchi                    41.410        0.40           103.525000                6.693835      -0.397940          1.617105
9       raipur                 1254.920       16.42            76.426309                6.255997       1.215373          3.098616
6  Muzaffarpur                  550.360       48.00            11.465833                3.519269       1.681241          2.740647
1        Dahod                  112.145       21.30             5.265023                2.396440       1.328380          2.049780``````

The data for street lights is almost the same. For electricity, it is a little different.

When log of population to the base 10 (x axis) is plotted against log of length of roads to the base 10, using the following code

We get the following graph:

Let us try to make a comparison. Let’s take the cities Jhansi and Indore.

Jhansi has a population of 5 * 10^6, and Indore has a population of 20 * 10^6, almost 4 times as big. If we compare log of length of roads, we see that the difference is more than 4 times. Log of length of roads for Indore is 10^3.5, and log of length of roads for Jhansi is 10^2.75. 10^3.5 / 10^2.75 is 5.6 . So, Indore is 5.6 times more creative than Jhansi, even though it is 4 times as bigger.

Similarly, we can make a comparison based on street light indicator.

The data looks like the following:

``````City Name  Number of Poles  Population  PolesPerCapita  PolesPerCapitaLog  PopulationLog  NumberofPolesLog
3  Dharamshala             3548        0.50        0.070960          -3.816850      -0.301030          3.549984
5       Kohima              837        1.15        0.007278          -7.102191       0.060698          2.922725
8    Thanjavur            11124        2.91        0.038227          -4.709272       0.463893          4.046261
0   Atal Nagar             7904        5.60        0.014114          -6.146700       0.748188          3.897847
1     Bareilly            31280        9.04        0.034602          -4.853010       0.956168          4.495267
4         KOTA            12909       10.00        0.012909          -6.275479       1.000000          4.110893
7     Srinagar            63750       11.80        0.054025          -4.210218       1.071882          4.804480
6       Raipur            54068       16.42        0.032928          -4.924535       1.215373          4.732940
2       Bhopal            20000       18.00        0.011111          -6.491853       1.255273          4.301030``````

The plot of log of population (x axis) vs log of number of street lights is as follows:

If we take Kohima and Raipur for the purpose of comparison, Kohima has a population of 1.15 * 10⁶, and Raipur has a population of 16.42 * 10⁶, which means Raipur is 14 times as big as Kohima, population wise. Log of number of street lights to the base 10 for Kohima is 10³, and for Raipur is 10^(4.75). That means Raipur is 10^(4.75) / 10³ , or 56 times more creative than Kohima.

If we continue to Electricity, log of electricity consumption to the base 10 does not yield a straight line that follows Kleiber’s law. Instead, if we plot log of electricity consumption per capita to the base 2 (x axis) vs log of population to the base 2, we get a line that follows kleiber’s law.

The code to aggregate data is:

The aggregated data looks like:

``````City Name   Electricity  Population  ElectricityPerCapita  ElectricityLog  ElectricityPerCapitaLog  PopulationLog
10     Tiruchirappalli      23.37000        9.17              2.548528        1.368659                 1.349664       3.196922
2             Belagavi      40.30000        4.88              8.258197        1.605305                 3.045827       2.286881
0             Agartala     319.10000        4.38             72.853881        2.503927                 6.186934       2.130931
7               Jaipur    2873.50100       30.70             93.599381        3.458411                 6.548427       4.940167
4               Bhopal    7339.37013       18.00            407.742785        3.865659                 8.671516       4.169925
9   Thiruvananthapuram    4040.40000        9.58            421.753653        3.606424                 8.720257       3.260026
5           Davanagere    2627.36000        5.21            504.291747        3.419520                 8.978115       2.381283
1             Amritsar    8059.09000       11.30            713.193805        3.906286                 9.478150       3.498251
6               Indore   17576.37000       19.90            883.234673        4.244929                 9.786653       4.314697
3            Bengaluru  131675.76680       84.30           1561.990116        5.119506                10.609170       6.397461
8               NAGPUR   90644.85000       24.10           3761.197095        4.957343                11.876976       4.590961``````

The code to plot the data is:

The plot looks like:

Let’s take Agartala and Indore for comparison. Population of Agartala is 4.38 * 10⁶, and of Indore is 20 * 10⁶. Which means Indore is almost 5 times as big as Agartala, population wise. Log of electricity per capita for Agartala is 2⁶, and for Indore is 2¹⁰. 2¹⁰ / 2⁶ is 16. Which means Indore is almost 16 times more creative than Agartala, despite being 5 times as big.

## Conclusion

In this post we saw that if a city is n times as bigger that the other, it is > n times more creative. It means a bigger city churns out more patents than it’s counterpart.

The levels of innovation required for reducing crime, installing new electric poles, constructing new roads and bike lanes, waste disposal system, etc. is higher in a bigger city.

The law that governs metabolism of energy in bacteria to plants also governs how a city expands. And I am sure it is plausible that if more research is conducted, this law would also be visible in how galaxies and supernovas expand.

Join Hacker Noon