<![CDATA[Henry Dashwood]]>
https://www.henrydashwood.com
RSS for NodeFri, 08 Nov 2024 12:51:35 GMT<![CDATA[California: the first three centuries]]>
## Prologue
This blog is going to tell the story of how Europeans discovered and eventually populated California. We’ll go as far as the settlement of San Francisco. But first, a word on what came before. Quoting Kevin Starr:
> _At the initial moment of European contact in 1492, something approaching one third of all Native Americans living within the present-day boundaries of the continental United States-which is to say, more than three hundred thousand people-are estimated to have been living within the present-day boundaries of California. This claim has been disputed by those who argue for a much larger Native American population for the continental United States, but no matter: the figures, however they compare to the rest of the continent, are still impressive. For centuries, hundreds of thousands of Native Americans had been making their homes, living their lives, in the place now called California._
Is this true? My sense is that it's an active area of debate amongst historians.
Here is a map of the population distribution of pre-columbian North America from
1957(!). So take it with fistfuls of salt etc.

Hopefully, LIDAR, genetics, and other sources help us improve our estimates. [Here’s a Reddit thread about that map](https://www.reddit.com/r/MapPorn/comments/qsfbnd/population_density_map_of_precolumbian_north/) if you’d like to read some more discussion about this.
## Beginnings
Kevin Starr has a great opening line for his book: “California entered history as myth”.
The myth was the 1510 novel Las Sergas de Esplandián (The Adventures of Esplandián) by Garci Ordonez de Montalvo. In Montalvo's tale the Californians were dark skinned Amazon's who travelled from their island east of the Indies to fight in the siege of Constantinople. The Spanish seem to have treated these novels like we do Arthurian legends, forever on the lookout for evidence that the story has a basis in reality. The novel certainly captured the minds of many a Spaniard over the following century. So much so that Miguel Cervantes made it the first book burnt by the abbot Don Quixote, blamed for driving the romantic knight mad.
In the early decades of the 16th century, the Spanish swept across the Caribbean and central America. Hernán Cortés arrived in Hispaniola in 1504, took part in the conquest of Cuba in 1511, and led the conquest of the Aztec empire from 1519. For more on Cortes I recommend this big [Matt Lakeman post](https://mattlakeman.org/2020/06/25/polygamy-human-sacrifices-and-steel-why-the-aztecs-were-awesome/) and the [series of episodes the Rest is History did](https://podcasts.apple.com/gb/podcast/the-fall-of-the-aztecs-the-adventure-begins-part-1/id1537788786?i=1000633588776) on the conquest.
In 1513, Vasco Nunez de Balboa, on the run from creditors, became the first European to lay eyes on the Pacific.

The possibility of reaching the spice islands of the East Indies by sailing west, and an underestimate of the Earth's circumference inspired Ferdinand Magellan set out west in 1519 on his circumnavigation of the world, to be completed by Juan Sebastián Elcano in 1522. For more on this I highly recommend [Jimmy Maher’s series](https://analog-antiquarian.net/2024/02/23/chapter-1-east-to-asia-west-to-asia/).
In 1532, having been passed over for the post of Viceroy of New Spain, Cortez was in search of a new big score. He commissioned Fortun Jimenez to sail west from Mexico. The following year Jimenez sailed across what is now called the Gulf of California and landed on what was believed initially to be an island. Remembering Montalvo’s romance, a member of this crew was probably the person to first refer to this land as “California”.
In 1535, Cortes himself crossed the gulf and arrived in Baja California at what is now La Paz. He named it Santa Cruz and spent two years trying to found a colony there. Forever searching for the city of gold across the next mountain, in 1538 he sent Francisco de Ulloa to explore the sea between Mexico and the “island” of California. Ulloa reached the head of the sea and discovered that it is in fact a peninsular.

Even though it only took a few years for Ulloa to show that Baja California is not an island, [the misconception persisted into future centuries](https://en.wikipedia.org/wiki/Island_of_California). For instance, here is a Dutch map made in 1650.

Cortes returned to Spain in 1541. In 1540, Antonio de Mendoza, the man whom he’d been passed over in favour of, sent Hernando de Alarcon to explore the lands to the north of the peninsular. Alarcon travelled 200 miles up the Colorado River. Either he or Melchor Diaz crossed the river near present day Yuma, Arizona and became the first European to set foot in Alta, or Upper, California.
In 1542, Mendoza sent Juan Rodríguez Cabrillo north along the western edge of Baja California to find a strait linking the Pacific and Atlantic. Cabrillo anchored in San Diego bay. He took his ships as far as Point Reyes with an infected shoulder. Then back to San Miguel island where he died. His lieutenant, Bartolome Ferrer, went as far north as the present border of California and Oregon before returning.
In 1564, Luis de Velasco, the new Viceroy of New Spain in Mexico City, commissioned Miguel de López de Legazpi to establish a Spanish presence in the Philippines.
It’s worth pausing to dwell on how extraordinary this story is. López de Legazpi was a second son from the Basque country who left for New Spain in 1528 aged ~26 seeking new opportunities. His career in New Spain saw him work in the mint, the courts, government, and the inquisition, and as well as a marriage that produced 9 children. In 1559 his wife died. By 1564, López de Legazpi was an old man, yet in 1565, after 93 days of sailing, 5 ships under his command arrived in the Philippines.
López de Legazpi had to fight and negotiate his way through an archipelago of peoples following Buddhism, Hinduism, Islam, and animism, and resist attacks from the Portuguese. Yet somehow he did and by 1571 had established himself as governor in the new capital of Manilla.
Spain would continue to rule the Philippines from Mexico city until 1822. And the Philippines was a Spanish possession until 1898.
For an economics paper with lots of historical context about the Spanish galleon trade across the Pacific see [this paper](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3693463) by Fernando Arteaga, Desiree Desierto, and Mark Koyama.
### Drake’s circumnavigation
In 1573, during an expedition to raid the Spanish silver train off the isthmus of Panama. Francis Drake climbed to the top of a tree with John Oxenham, his Lieutenant, and Pedro, the leader of the escaped slaves known as the Cimarróns. From this viewpoint, Drake and Oxenhome became the first Englishmen to see the Pacific.
Fulfilling the vow he had made at the top of the tree to sail the Pacific, Drake set off on his “famous voyage” in 1577. The practical goals were to:
- Reach the Pacific through the Strait of Magellan.
- Plunder Spanish cities and ships on Pacific coast.
- Search for a northwest passage to England, claiming territory on route.
- Cross the Pacific to the East Indies
This was the first circumnavigation of the world in 58 years. It would become only the second to be accomplished as a single expedition, and Drake would be the first person to circumnavigate the world as captain while leading it the entire way.
Drake suffered great attrition to disease during the Atlantic leg of his expedition to disease and damage. But in 1578 he entered the Pacific and raided and captured his way up the Pacific coast of South America. Reduced from 5 ships to just the Golden Hind, herself with only a 100 tons burden carrying 30 tons of treasure, Drake carried on north.
The expedition passed Baja California in 1579 in search of a place to prepare for their journey back to England, possibly via the rumoured Strait of Anián. They proceeded perhaps as far as the present state of Washington before turning south.
On 17th June, the expedition pulled into what is now known as Drake’s Bay on the Point Reyes peninsula to repair the ship for 5 weeks. Drake explored the surrounding area and had friendly interactions with the native Coast Miwok tribe. The first Book of Common Prayer services were performed in North America during this time. Drake left behind a brass plaque claiming the territory for the crown as “New Albion”.
15 months later, on 26th September 1580, the Golden Hind returned to England with Drake and 59 crew on board having crossed the Pacific and rounded the Cape of Good Hope. The queen's half-share of the cargo surpassed the rest of the crown's income for that entire year.

## Back to the Spanish galleon trade
In 1584, Francisco de Gali discovered that the best way to get from the Philippines to New Spain was to follow the Japanese current eastward to the coast of Alta California off Cape Mendocino, then sail down the coast of Alta and Baja California to Mexico. However this journey still took 200 days. So a plan formed in the mind of Pedro de Moya y Contreas, Viceroy of New Spain, to find and develop a port in Alta California to break the journey.

The following year, Sebastian Rodriguez Cermeno was tasked with a mission to take the galleon San Augustin across the pacific and explore Alta California for possible ports. Cermeno anchored in the same port as Drake had and named it the Bay of San Francisco. However, a storm drove the ship aground and his crew had to limp back home in a makeshift launch, missing San Francisco bay on the way south.
Clearly it made much more sense to explore Alta California via an expedition northward from Mexico instead of from across the Pacific.
In 1602, three vessels under the command of Sebastian Vizcaino sailed from Acapulco to the bay of San Diego. They sailed up the coast to a bay he named after the Viceroy, the Conde de Monterrey, but missed San Francisco Bay. The expedition sailed as far north as Cape Mendocino before turning back. Maps were made and Vizcaino promoted the use of Monterrey as a port. But ultimately he went on to an illustrious career where he was involved in mapping Japan and nothing was done about Alta California for another 167 years.
## Explaining the gap
Why didn’t anything happen during this time? Kevin Starr has two explanations:
The economic explanation - although it would have been nice to have a port for the galleons, the Spanish empire was already overstretched and didn’t have the capacity or need to expand into Alta California.
The political explanation - the Spanish empire was governed under a series of regulations drawn up in the 1570s and organised into the laws of the Indies in 1680. In minute detail including things like town planning these called for the integration and interaction of ecclesiastical and secular societies. Church and state were to cooperate in a way that would promote the worldly and other-worldly being of the colonists. The Spanish were able to bring this system as far north as Santa Fey, founded 1609. But didn’t have the resources to expand further.
The work of colonising Arizona and Baja California, with a view to Alta California in the future would be taken up by the Jesuits. Italian born missionary Eusebio Francisco Kino, having spent 1683 to 1685 trying to start a mission in Baja California, established a string of them through Sonora into present day southern Arizona, then west to the confluence of the Gila and Colorado rivers on the present border of California.
In 1691, Kino was joined by fellow Italian Juan Maria de Salvatierra. Both were suspicious of mixing missionary work with secular ambitions and disapproved of how the secular Spanish authorities treated natives who didn’t comply with them. They secured permission in 1697 for the Jesuits to enter Baja California where they established the first Jesuit mission of Our Lady of Loretto. [Eventually there would be 18 missions in Baja California](https://vivabaja.com/missions1/) running north in tandem with the ones established by Kino in Sonora and southern Arizona on the other side of the gulf of California.

Kevin Starr describes the Jesuits and their system like so:
> _Under the Laws of the Indies and accepted church practice, mission theory had as its goal the evangelization of Native Americans and their education in religion and the manual arts during a period of residency and transition in a mission, leading eventually to their introduction into secular society as gente de razón, which is to say, full-fledged "people of reason," baptised Catholics and useful citizens. At this point (at least in theory), the missions were to put themselves out of business and be replaced by a diocesan parish structure staffed by secular clergy under the control of a local bishop. So much for theory. The reality, especially in missions entrusted to Jesuits - the Reductions (mission colonies) of Paraguay, most notably - was far more complex._
> _Founded (three years before Cabrillo was exploring the California coast) by Ignacio de Loyola, a Basque soldier turned priest-reformer, the Company (or Society) of Jesus, more commonly known as the Jesuits, rapidly developed into a powerful order of scholars, educators, missionaries, and advisers to the great and powerful. The Jesuits were also an international organisation of far-reaching influence. As missionaries they were unsurpassed, beginning with the efforts of one of their original co-founders, Francis Xavier, in the Far East._
> _The Jesuits believed in enculturation, that is, the adaptation of Catholicism (as far as orthodoxy permitted) to the culture of those being evangelised. They also sought to protect such peoples and their cultures from catastrophic disruptions by soldiers and civilians. Established in the late sixteenth century in Paraguay, the Jesuit Reductions were fashioned as theocratic communities blending Spanish and Native American cultures, quasi-autonomous as far as secular authority was concerned, but thoroughly under the controlling guidance of Jesuit missionaries. Such was the Jesuit strategy - the protection of Indians in enclave utopias - but it was also the problem as far as secular authorities were concerned, especially after Enlightenment attitudes began, however tentatively, to enter Spanish thinking and a growing resentment began to coalesce against the power of the society._
The Jesuits' growing power and autonomy concerned the Spanish crown. They accumulated wealth through the labour and resources of the missions, and their influence extended beyond purely spiritual matters. This autonomy was viewed with suspicion, especially as the Jesuits operated independently of secular colonial authorities. The crown feared that the Jesuits could become a state within a state, undermining royal control.
Meanwhile, geopolitical threats were looming. Russia was expanding southward from Alaska, establishing settlements along the Pacific coast. The British and French were also increasing their presence in North America. Spain realised that it needed to assert control over Alta California to prevent other European powers from encroaching on its territories.
In 1765, King Carlos III sent inspector general Jose de Galvez to New Spain with the task of suppressing the Jesuits. In 1767, he issued the Pragmatic Sanction, expelling the Jesuits from all Spanish territories. The expulsion resulted in more than 5,000 Jesuits being moved to the Papal States for protection. This was part of a broader movement across Europe, where Jesuits were seen as too independent and influential.
In 1768, Galvez arrested and exiled the Jesuits from Baja California. Gaspar de Portola was appointed Governor of Las Californias. He seems to have been sympathetic to the Jesuits and organised their deportation with diplomacy and kindness, though still to the consternation of the Indians whose numbers in Baja California fell dramatically.
To replace the Jesuits, Galvez appointed Franciscans under Father Junipero Serra, a man of extreme piety even by the ascetic standards of his order. Discovering to his dismay the state of the missions under Spanish solidiors, they were supported by Galvez, who transferred control to the friars.
## The settlement
These three men, Galvez, Portola, and Serra, would be the ones to initiate the settlement, finally, of Alta California.
On 9th January 1769, three newly built ships: the San Carlos, San Antonio, and San Jose set sail for La Paz en route to San Diego. On 24th March, two overland land parties of 300 men set off from Baja to Alta California.
The San Jose sank before it could reach San Diego. The San Antonio completed the journey to San Diego in 54 days. The San Carlos took twice as long and made landfall with a crew crippled by scurvy. When the parties consolidated on 1st July half of the members of the expedition were already dead. And more would carry on dying as the San Antonio sailed back to La Paz for supplies and reinforcements.
On 16th July, as they waited for the ship to return, Serra dedicated the Mission San Diego de Alcala. Portola led a scouting party north and reached the Bay of Monterey. They found it was much smaller than the exaggerated report made by Vizcaino nearly two centuries before. So they carried on north and found San Francisco Bay.
Now into 1770, Portola turned his party back on 24th January. He found the camp in San Diego sick and dying. A party of 40 fit men was organised to head back to Baja California for relief. However, the expedition was to be saved on 19th March when the San Antonio returned with supplies and reinforcements.
On 3rd June, after the San Carlos had returned with supplies, Portola established a settlement at Monterey: the Mission San Carlos Borromeo.
The same tensions that had existed in the Jesuit period between missionary and secular motives remained. Only San Jose de Guadalupe (1777) and Los Angeles (1781) were chartered as pueblos, or secular townships.
The tensions between the secular and spiritual authorities didn’t end with the expulsion of the Jesuits. Serra quarrelled with the military governors over many things, particularly the violence of the soldiers. He journeyed back to Mexico City to demand Portola’s successor Pedro Fages be removed. He also quarrelled with the next two governors, Fernando Rivera y Moncada and Filipe de Neve.
There was also the problem that no one wanted to live this far out on the California frontier. Villa de Branciforte (1796) was established as a retirement settlement for soldiers but ended up being used as a penal colony. Soldiers were posted to Alta California as punishment.
The Viceroy to whom Serra appealed, Antionio Maria Bucareli, was another major figure in establishing California. He sent Juan Bautista de Anza on two missions, to reconnoitre a land route between Mexico and California, and to establish a settlement on San Francisco Bay.
In 1774, Anza set forth from Tubac, south of present day Tucson. He found a route to Los Angeles and Monterey before returning to Tucson to assemble the party to settle San Francisco Bay. This party 1776 would arrive on the site of modern San Francisco on 27th June. Meanwhile in 1775, the San Carlos under Juan Manuel de Ayala found the mouth of San Francisco Bay: the Golden Gate.

California under the Spanish was a coastal enclave. The settlers were surrounded on all sides by violent hostile forces. The first mission established by Serra, San Diego de Alcala, was burnt down by natives within months. The San Diego mission was attacked in 1775. Yuma people massacred people travelling along Anza's overland route in 1781, closing it off for the next 40 years.
The missions would expand slightly north over the next decades: San Rafael Arcangel was established in 1817 and San Francisco Solano was in 1823. Yet the most interior mission, Nuestra Señora de la Soledad, founded in 1791, was just 30 miles from the coast.
Junipero Serra died in 1784 at San Carlos Borromeo. He had personally founded 9 missions, of an eventual total of 21. You can see an [animated timeline and map of their foundations here](https://californiamissionguide.com/california-mission-guide/california-mission-map/)

## Recommended Reading
- California: A History - Kevin Starr
### Books I’ve not yet read but plan to
- Before Columbus: The Americas of 1491 - Charles C. Mann
- 1493: Uncovering the New World Columbus Created - Charles C. Mann
]]>
https://www.henrydashwood.com/posts/california-the-first-three-centuries
https://www.henrydashwood.com/posts/california-the-first-three-centuriesWed, 09 Oct 2024 00:00:00 GMT<![CDATA[24-09-18 Roundup]]> _But it doesn’t stop there. Elizabeth has a very unusual trick up her sleeve to cement our proximity to the charge. While the men look past us at an enemy we can sense but not see, many of the horses are instead staring at us. There’s no mistaking the direction of those straining equine eyes. This is one of the most unusual innovations I’ve ever seen from a top end painter. We’re used to people making direct eye contact with us from within a picture, but not a group of animals at full pelt. Once you’ve noticed it, you can’t look away. The central horse in particular grabs our attention. Its ears are pricked forward and its head is slightly turned and up as though it’s just spotted us. For me, this visceral animal connection is a great help in joining us with what’s unfolding. These horses are aware of us; they’re coming for us. We are no longer observers looking on from a safe distance as is the case with many paintings of war. We’re right there, about to be overrun by a panicky looking stampede._
---
[On the origins of the Monster drinks brand](https://www.sfgate.com/food/article/bay-area-monster-energy-logo-inventor-19743126.php)
---
[Book Review: The Two Parent Privilege](https://www.ariababu.co.uk/p/book-review-the-two-parent-privilege)
---
[How to Succeed in Mr Beast Production](https://drive.google.com/file/d/1YaG9xpu-WQKBPUi8yQ4HaDYQLUSa7Y3J/view)
and a couple of other bits about management and culture that people have shared in response:
- [The Eleven Laws of Showrunning](https://okbjgm.weebly.com/uploads/3/1/5/0/31506003/11_laws_of_showrunning_nice_version.pdf)
- [Facebooks's Little Red Book](https://spaccapeli.com/i-remastered-facebooks-little-red-book)
---
[Generative ML in chemistry is bottlenecked by synthesis](https://www.owlposting.com/p/generative-ml-in-chemistry-is-bottlenecked)
]]>
https://www.henrydashwood.com/posts/24-09-18-roundup
https://www.henrydashwood.com/posts/24-09-18-roundupWed, 18 Sep 2024 00:00:00 GMT<![CDATA[24-08-16 Roundup]]> _Uber and BYD make no mention of the US in their statement, likely because the market is virtually closed off to the carmaker. President Joe Biden has vowed to increase tariffs on Chinese EVs to 102.5% this year, ratcheting up a rate that former president Donald Trump raised to 27.5% during his four years in the White House._
> _The European Union and countries including Canada have since followed suit in adopting or considering higher duties on Chinese EV imports, which could further complicate Uber’s objective for 100% of its rides in US, Canadian and European cities to take place in electric vehicles by 2030._
And [German industrial production is in decline](https://marginalrevolution.com/marginalrevolution/2024/07/germany-fact-of-the-day-12.html)
This is mostly a story of Europe's self imposed high energy costs. But that won't stop people trying to find other answers.
Britain stands out for not having put up or proposed tariffs yet. Will be interesting to see how much our car market diverges this decade.
Also meanwhile...
[Apple to Manufacture 'Pro' iPhone Models in India for the First Time](https://www.macrumors.com/2024/07/29/apple-to-manufacture-pro-iphone-models-in-india/)
[Apple Drops to Sixth Place in China's Smartphone Market](https://www.macrumors.com/2024/07/26/apple-drops-to-sixth-place-in-china/)
[Apple Lowers iPhone Prices and Eyes iPad Assembly in India](https://www.macrumors.com/2024/07/26/apple-cuts-iphone-prices-in-india/)
## Miscellaneous
[Matt Yglesias Considered As The Nietzschean Superman](https://www.astralcodexten.com/p/matt-yglesias-considered-as-the-nietzschean)
---
[Why has violent crime declined in Britain?](https://www.aporiamagazine.com/p/why-has-violent-crime-declined-in)
---
[How to Build Anything Extremely Quickly](https://learnhowtolearn.org/how-to-build-extremely-quickly)
---
[The deep ocean floor is covered in naturally-occurring batteries that make oxygen](https://theeggandtherock.com/p/the-deep-ocean-floor-is-covered-in)
---
[Your Book Review: How the War Was Won](https://www.astralcodexten.com/p/your-book-review-how-the-war-was)
and
[The Past and Future of Military Drones](https://www.palladiummag.com/2024/08/09/the-past-and-future-of-military-drones)
---
[Revolutionary Math Proof No One Could Explain...Until Now](https://youtu.be/RX1tZv_Nv4Y?si=eQD_ptGqjshX_it7)
via Peter Woit, who writes at [his blog](https://www.math.columbia.edu/~woit/wordpress/):
_Frenkel covers a wide range of topics about unification in math and physics and the difference between these two subjects. While there’s a lot about mathematics, Frenkel also gives the most lucid explanation I’ve ever heard of exactly what string theory is, what its relation to mathematics is, and what its problems are as a theory of the real world._
---
_"And there too", Woland pointed backwards. "What good is your little
basement now?" The reflected sun faded from the windows. "Why go back?"
Woland continued, quietly and persuasively. "0 thrice romantic master,
wouldn't you like to stroll under the cherry blossom with your love in the
daytime and listen to Schubert in the evening?"_
[Sonata in A minor](https://youtu.be/NNcQuY1isEI?si=oBDyo2RoNHAvxw3m)
]]>
https://www.henrydashwood.com/posts/24-08-16-roundup
https://www.henrydashwood.com/posts/24-08-16-roundupFri, 16 Aug 2024 00:00:00 GMT<![CDATA[24-07-25 Roundup]]>
https://www.henrydashwood.com/posts/24-07-25-roundup
https://www.henrydashwood.com/posts/24-07-25-roundupThu, 25 Jul 2024 00:00:00 GMT<![CDATA[24-07-7 Roundup]]> _Under current rules, state officials conduct an assessment every four years to see if cities are meeting their housing goals. There are penalties for noncompliance, including loss of local control over housing development. San Francisco’s next state assessment was originally scheduled for April 2027, giving supervisors plenty of time to peacock while renters continued to suffer. Now, however, thanks to Wiener’s amendment, the city’s housing plans will be assessed annually, starting in spring 2024._
>
> ...
>
> _Once SB423 goes into effect in the spring, and San Francisco flunks its state assessment, getting new housing approved will be much more like getting your license renewed at the DMV: You fill out some basic paperwork, pay the processing fees and the only frustrating part should be waiting in line for your short appointment at the counter._
Spring is now here and San Francisco's new streamlined system is coming into force
> _San Francisco being subject to SB423 means that most proposed housing projects will not require approval from the Planning Commission and therefore won’t be able to be appealed to the Board of Supervisors. Most projects won’t have to undergo extensive environmental reviews. The streamlining does not apply to large projects that are subject to “development agreements,” like the Hunters Point Shipyard, Pier 70, Treasure Island or the redevelopment of Stonestown. It also doesn’t apply to projects inconsistent with zoning and affordable housing standards or those proposed for properties that include a historic resource._
>
> _Wiener said the law would “dramatically accelerate the time it takes to approve most new housing in San Francisco,” with the city obligated to process applications within 180 days, compared with the current time frame, which is 26 months. Wiener called the commencement of SB423 a “watershed” moment and credited the city’s YIMBY organizations with pushing pro-housing laws._
>
> ...
>
> _About 23% of housing built in San Francisco is under a development agreement and would not be eligible for SB423. The rest will likely use the legislation for faster approvals, according to Wiener communications director Erik Mebust._
SB423 will gradually take affect across more of California as other cities get assessed.
Quotes from [here](https://www.sfchronicle.com/opinion/openforum/article/sf-supervisors-housing-nimby-wiener-18383235.php) and [here](https://www.sfchronicle.com/sf/article/s-f-housing-goals-19545405.php)
### New Zealand
Some amazing housing reforms coming out of New Zealand (Quotes from [here](https://www.rnz.co.nz/news/national/521235/government-to-flood-cities-with-more-housing-by-liberalising-planning-rules)) where the government will:
> _abolish councils' ability to set fixed urban-rural boundaries and will abolish powers that let councils mandate balconies or minimum floor area sizes for developments._
and
> _require the 24 city, district, and unitary councils representing our largest cities to zone for 30 years of housing growth. This covers larger cities like Auckland, Wellington, and Christchurch, as well as smaller cities like Tauranga, Hamilton, and Dunedin._
>
> ...
>
> _In Government, Bishop has added two details to the policy that appear to make it far stronger._
>
> _The National Policy Statement on Urban Development (NPS-UD), former Housing Minister Phil Twyford's landmark housing policy to liberalise land use, already requires councils to plan for 30 years of housing demand, however, it only requires councils to "live-zone" feasible development capacity to meet three years of demand at any one time._
>
> _"Live-zoning" means that the land can be used for housing under a plan that is legally operative and in effect and "feasible development" means housing capacity that is commercially viable for a developer to build and make a profit from._
>
> _Bishop's changes will require councils to soon make changes to "live zone" this "feasible development capacity" for the next thirty years, rather than the next three, freeing up vastly more space._
and
> _require councils to use "high" demand projections when assessing the amount of houses they need to zone._
and
> _"strengthen" zoning requirements around transit corridors. Twyford's changes required councils to enable at least six-storey development around rapid transit corridors. Bishop said these requirements currently only apply to Auckland and Greater Wellington's rail networks and the Auckland Northern Busway._
>
> _Bishop will say the Government will force councils to add more transport corridors to this list by adding requirements for councils to zone density around "strategic transport corridors". The corridors will be determined by councils, but subject to criteria set by central government._
and
> _look to end the fight around what actually qualifies as rapid transit under the existing rules, which has triggered an "interminable and frankly boring debate" about Wellington's Johnsonville train line._
>
> _The speech will say the Government will "probably" reach over the head of councils by simply listing the specific train lines and busways that trigger the upcoming requirements._
There is also this:
> _The Government is making good on National's coalition agreement with Act to make National and Labour's bipartisan Medium-Density Residential Standards (MDRS - often called the sausage flat rules) optional for councils._
>
> _All councils currently required to implement the MDRS will be required in legislation to carry out a ratification vote to determine whether they want to retain, alter, or remove the MDRS planning changes._
>
> _Councils that vote to alter or remove the MDRS can do so, provided they give effect the new Government's other pro-development policies in the very same plan change._
For context on New Zealand's recent planning history, Eleanor West & Marko Garlick have [a piece in Works and Progress](https://worksinprogress.co/issue/upzoning-new-zealand)
## Science and Technology
It's now been confirmed that the 5th Busy Beaver number is 47,176,870. Here is [Scott Aarronson's write up](https://scottaaronson.blog/?p=8088) and here is [a big Quanta piece](https://www.quantamagazine.org/amateur-mathematicians-find-fifth-busy-beaver-turing-machine-20240702) about the journey to get here.
Some great characters are profiled in this piece. Exactly what you'd expect from a group of people who connect over the internet to solve a "pointless" mathematical problem e.g. Pavel Kropitz:
> _a Slovakian contributor who doesn’t speak English and communicates with the rest of the team using Google Translate_
and _mei_ who:
> _grew up in Poland and attended the University of Warsaw for one semester in fall 2021 before dropping out — the rigidity of the curriculum and the move to remote instruction after a surge of Covid-19 cases didn’t fit well with their learning style. They worked at a software company for a little over a year but increasingly found the work draining, and began looking for something more intellectually stimulating. They found it in Coq, the software designed to encode and certify the validity of mathematical proofs._
and is now:
> _pulling back, after developing a fascination with the European international rail network. “I will probably come back to busy beaver things again at some point, but currently it’s not the thing on my mind,” they said. “I’m currently pursuing becoming a train driver.”_
and _mxdys_:
> _a mysterious new contributor known only by the pseudonym mxdys came in to finish the job. Nobody on the team knows where mxdys is located or any other personal details about them. In a Discord direct message exchange, they mentioned a long-standing interest in mathematical games, but they declined to provide more information about their background._
>
> _On May 10, mxdys posted a characteristically succinct message to the Discord server: “The Coq proof of BB(5) is finished.” Stérin replied a minute later with a series of seven exclamation points. In a matter of weeks, mxdys had refined the community’s techniques and synthesized their results into a single 40,000-line Coq proof._
## Miscellaneous
[The Christian Church Didn't Save the West from Cousin Marriage](https://mankind.substack.com/p/quick-take-the-christian-church-didnt)
---
[When RAND Made Magic in Santa Monica](https://asteriskmag.com/issues/06/when-rand-made-magic-in-santa-monica)
---
[Will eating nothing but Sweetgreen for two weeks make you somehow… better?](https://www.eater.com/24152247/sweetgreen-salad-size-me-healthy-eating)
TLDR:
> _On the walk over, I could feel my pants slipping down off my waist a bit. Though it wasn’t my end goal, I’d shed about five pounds on my Sweetgreen diet, dropping one full notch on my belt_
There's an automation story in this piece
> _But for a company that so fervently champions the value of human capital, it’s notable that Sweetgreen is actively plotting to replace jobs with automation. The company recently launched a pilot project called Infinite Kitchen that incorporates automation technology it acquired with the purchase of Spyce — a robotics startup backed by high-profile chefs like Thomas Keller and Daniel Boulud —for $50 million in 2021. The salad-dispensing robots that power Infinite Kitchen can increase throughput to over 500 bowls per hour. Early returns from its two pilot locations indicated that Infinite Kitchen increased the average check by 10 percent, and profit margins by 7 percent, while significantly reducing mistakes._
But how far can this push costs down?
> _I asked a supply chain expert with more than 20 years of experience whether she thinks Sweetgreen is equipped to become the McDonald’s of our generation. “On the very highest level, no,” says Karen Karp, who founded KK&P, a consultancy that advises companies like Pret A Manger on food sourcing. “The main reason is that everything except for maybe coffee grounds and milk in the McDonald’s supply chain is a nonperishable product or frozen. It’s a product that is manufactured in some centralized place and shipped to thousands of franchises.” Because Sweetgreen’s business model is predicated on highly perishable food, it can’t benefit from the same protracted shelf life of processed foods like McDonald’s does._
See also: [The economics of a Sweetgreen salad](https://sherwood.news/business/the-economics-of-a-usd15-sweetgreen-salad)
Personally, in London I think Farmer J is great. Others like Tossed seem to be "cheaper" and based on store openings and closings near me seem to be in retreat.
]]>
https://www.henrydashwood.com/posts/24-07-7-roundup
https://www.henrydashwood.com/posts/24-07-7-roundupSun, 07 Jul 2024 00:00:00 GMT<![CDATA[24-06 Links]]> _TfL and the boroughs’ continued work to develop Cycleways in London means the strategic cycle network has more than quadrupled in size from 90km in 2016 to 390km in June 2024._
---
[Unveiling AVA: The Adaptable Footbridge and Lift System of the Future](https://expedition.uk.com/article/unveiling-ava)
> _AVA is faster to deliver and simpler to install compared to standard industry practices. The streamlined approval and design periods, coupled with the modular system featuring bolted connections, transform the assembly process. With internal cladding, glazing, and services installed before the bridge leaves the yard, only a single possession is required._
It's not particularly aesthetic but it is functional and cool to see real attention given to construction productivity and driving costs down
---
https://x.com/60sjapanfan/status/1804554769924551004
---
[101 things we now know about US housing markets](https://ronanlyons.substack.com/p/101-things-we-now-know-about-us-housing)
Ronan Lyons has started a newsletter looking at findings from his work on a historical dataset of US house prices.
---
[First Universal theme park in Europe to generate '£50bn of economic benefits for UK'](https://news.sky.com/story/first-universal-theme-park-in-europe-to-generate-50bn-of-economic-benefits-for-uk-13158683)
> _Locally, not far from the proposed Bedfordshire site is the Harry Potter Experience at the Warner Bros studio tour near Watford, while there is Woburn Safari Park to the immediate north and Whipsnade Zoo to the immediate west of Luton._
---
[Can Labour build 1.5 million homes?](https://www.samdumitriu.com/p/can-labour-build-15-million-homes)
300k a year isn't going to cut it anyway. Need to pump those numbers up!
---
Incredible policy failure...
https://x.com/alfred_twu/status/1803609400839389469
## Science and other tech stuff
...One way to treat the symptom!
https://x.com/ArcherAviation/status/1803776865544622230
---
[On earthquake prediction](https://asteriskmag.com/issues/06/the-fault-in-our-forecasts)
---
[History of nanopores and their use in DNA sequencing](https://press.asimov.com/articles/nanopores)
---
[Solving Atherosclerosis: The Small but Mighty Molecule](https://www.lifespan.io/news/solving-atherosclerosis-the-small-but-mighty-molecule)
> _We’re continuing to engage with the MHRA. In fact, we have another scientific advice meeting in two weeks that we’ll be holding virtually. We’re excited to be working with the MHRA and hopefully doing part of our Phase 2 clinical trial in the UK._
> _To remind your readers, we were one of the first recipients of the UK’s ILAP program, the innovative licensing and access pathway, and that’s what really brought us to the UK. In addition to the good environment there, lots of collaborators, lots of innovation happening, especially in the imaging field in the UK._
> _The bad thing is that post Brexit, it seems that the MHRA has gotten a bit backlogged and isn’t able to keep up with our current demands on their time. It takes too long to get meetings and responses to applications currently. We’ve had to take our first human clinical trial to Australia, where it’s a faster, more streamlined, and cheaper process._
> _We are really excited to be working with some great people there. Stephen Nicholls, a world-renowned cardiologist, who we brought on as an advisor, has really helped pave the way and show us the ropes of how to navigate the system and get things going really fast in Australia. We think we’ll be able to efficiently get our trial done there._
---
[Will We Ever Get Fusion Power?](https://www.construction-physics.com/p/will-we-ever-get-fusion-power)
And some AI fusion progress this month...
https://x.com/pfau/status/1800961530084643127
---
[How AI Revolutionized Protein Science, but Didn’t End It](https://www.quantamagazine.org/how-ai-revolutionized-protein-science-but-didnt-end-it-20240626)
---
[The best known ice nucleator is a bacterium called Pseudomonas syringae, which has a protein that can force water to freeze at around minus 2 degrees Celsius. “It’s so good that all the artificial snowmaking, at least in Utah, and some \[other\] places in the U.S., uses this bacteria to make snow”](https://www.quantamagazine.org/the-enduring-mystery-of-how-water-freezes-20240617)
---
https://x.com/Erdayastronaut/status/1804530882528661588
---
[London Underground hosts tests for ‘quantum compass’ that could replace GPS](https://www.theguardian.com/science/article/2024/jun/15/london-underground-quantum-compass-gps-subatomic-instrument-locations)
---
[The Untapped Potential of Geothermal Energy](https://www.contrary.com/foundations-and-frontiers/geothermal)
## Business / Finance / Management Stuff
[High frequency trading is cool and good actually](https://blog.headlandstech.com/2024/05/01/opinion-rationalizing-latency-competition-in-high-frequency-trading)
---
[How to hire low experience, high potential people](https://worktopia.substack.com/p/how-to-hire-low-experience-high-potential)
---
[Managing Lockheed’s Skunk Works](https://www.freaktakes.com/p/managing-lockheeds-skunk-works)
---
https://x.com/mihail_eric/status/1800578001564057754
---
[On Alpine's CEO training programme](https://www.businessinsider.com/alpine-investors-ceo-in-training-program-how-it-works-2024-6)
https://www.bloomberg.com/opinion/articles/2024-06-24/boomer-candy-business-is-booming
---
[Nice overview of the insurance industry](https://www.felixstocker.com/blog/cannibals). Lots of non-household names that keep it ticking along behind the scenes
---
[On Alfred Winslow Jones](https://commoncog.com/c/cases/aw-jones-hedge-fund)
## People
[New York or London — what’s your table talk style?](https://www.ft.com/content/f8996348-a703-45b1-bfb5-042250100865)
Hadn't heard the phrase "single table conversation" before. I think it could work well. But probably the responsibility of the host.
---
[Is app-based dating ruining everything?](https://www.avabear.xyz/p/is-app-based-dating-ruining-everything)
It's genuine challenge going into dating mode cold. Can feel quite transactional and romance-less.
## Miscellaneous
https://x.com/CityPolice/status/1798313399115505911
24 phones were found on him. How many previous convictions?
[DNA Spray is a cool idea](https://www.selectadna.co.uk/news/met-police-launches-dna-tagging-spray-against-moped-crime). It seems to be [helping](https://www.cityoflondon.police.uk/news/city-of-london/news/2023/november/phone-snatching-halved-in-the-city-of-london) the City of London police.
---
Hadn't thought of this before. Couldn't it have been Apple cracking down on ad tracking though?
https://x.com/itsandrewgao/status/1797153212643828042
---
[How to Write a Law](https://www.repository.law.indiana.edu/cgi/viewcontent.cgi?article=2496&context=facpub)
Some good advice in this talk for anyone who needs to work with clients or who aspires to write clearly
---
Alternative Greenwich pub recommendations from a friend, after I mentioned the Trafalgar Tavern:
> _The Old Brewery if the weather is good. It has infinite space (as it spills into the grass in Wren's ORNC), and the setting is actually considerably nicer than Trafalgar, looking over the UNESCO world heritage site and the river_
> _Prince of Wales (Blackheath)_
> _Hare & Billet (Blackheath)_
> _Richard I (Greenwich)_
> _The Cutty Sark (pub, Greenwich, a few mins further along the riverside from Trafalgar). Oldest pub in Greenwich and it shows!_
> _Coach & Horses (inside the covered market)_
> _Gipsy Moth, but it's completely generic_
> _Guildford Arms is very nice with a big outside idea_
---
[You can take screenshots on streaming services if you turn off hardware acceleration in your browser's settings](https://www.reddit.com/r/LifeProTips/comments/u63dzd/lpt_you_can_get_around_screenshot_blocking_from)
---
[Why Is Everyone on Steroids Now?](https://www.gq.com/story/why-is-everyone-on-steroids-now)
Reminds me of [this Palladium piece](https://www.palladiummag.com/2019/01/01/competitive-hormone-supplementation-is-shaping-americas-future-business-titans) from a few years ago
---
https://x.com/ankurnagpal/status/1802093254826955018
And [Lisa Whedon on O1 Visas](https://youtu.be/0WAv_EMvQPc)
---
I adore Jimmy Maher's Analogue Antiquarian blog. He's currently telling [the story of Ferdinand Magellan](https://analog-antiquarian.net/2024/02/23/chapter-1-east-to-asia-west-to-asia)
Remember, kids, Magellan's A LOT COOLER THAN JUSTIN BIEBIER
https://x.com/peteoxenham/status/1805087395164922336
---
[There Is No Such Thing As Supply](https://www.economicforces.xyz/p/there-is-no-such-thing-as-supply-39c)
---
[C.S. Lewis on progress](https://rudzki.com/texts/cs-lewis-on-progress)
_But it will be no use asking, ‘What have I done to deserve this?’ The Straightener will reply: ‘But, my dear fellow, no one’s blaming you. We no longer believe in retributive justice. We’re healing you.’_
---
[Small drones will soon lose combat advantage, French Army chief says](https://www.defensenews.com/global/europe/2024/06/19/small-drones-will-soon-lose-combat-advantage-french-army-chief-says)
Meanwhile...
[China State Shipbuilding Corporation](https://www.kitstack.xyz/p/china-state-shipbuilding-corporation)
---
[Someone has put all of Paul Graham's essays on Github as an ePub](https://github.com/ofou/graham-essays?tab=readme-ov-file)
1329 pages (so far!)
---
[Zepto, a 10-minute delivery app, raises $665M at $3.6B valuation](https://techcrunch.com/2024/06/20/zepto-a-10-minute-delivery-app-raises-665-million-at-3-6-billion-valuation)
Do the economics of this work in India in a way that they didn't here a few years ago? Cheaper labour, existing dabbawala network? Dunno. But it would be cool if VC subsidised deliveries come back
---
[The Dutch Salten Age](https://www.ageofinvention.xyz/p/age-of-invention-the-dutch-salten)
---
[Arthur's Battles: A new perspective](https://www.arthwys.com/p/guest-feature-p5ych0p0mp-arthurs)
]]>
https://www.henrydashwood.com/posts/24-06-links
https://www.henrydashwood.com/posts/24-06-linksSun, 30 Jun 2024 00:00:00 GMT<![CDATA[24-05 Links]]> _Nobody compounded their money at 66% annualized for thirty years. Not Jim Simons, not James Ax, not Leonard Baum, not Elwyn Berlekamp. Everyone gets cashed out to some degree, because it's economically implausible for their money to keep compounding that fast forever. And when a given strategy can produce high returns on capital based on the specialized knowledge of the people creating and implementing that strategy, the specialists will have all the leverage in deciding how returns will be allocated... The most sustainable structure for such an investment vehicle is for all of the returns to go to the people who are producing them, except for a slice that goes to people who could produce a subset of them but could be paid not to._
---
[Taking Risk](https://tomblomfield.com/post/750852175114174464/taking-risk)
A great piece reflecting on how start-ups are a more accepted career route in the US than the UK. Ends up saying that we just have to wait for the numbers of former founders and execs with money and skills to grow.
---
[Monzo Nabs a \$5.2 Billion Valuation After Raising More Money - Bloomberg](https://www.bloomberg.com/news/articles/2024-05-08/monzo-nabs-a-5-2-billion-valuation-after-raising-more-money?embedded-checkout=true)
Amongst my friends, Monzo is the overwhelming winner. But on the continent, [Revolut](https://www.bloomberg.com/news/articles/2024-04-15/revolut-valuation-raised-by-investor-schroders-as-fintech-fortunes-rebound) is everywhere.
Meanwhile, Latin America's [NuBank](https://www.ft.com/content/87e13cc7-ce1e-42a4-aeb7-992ad1ca44b9) is even bigger still
---
## Product recommendations
[Notion Calendar](https://www.notion.so/product/calendar), formerly known as Cron, is the best calendar product I've found. I've tried Google and Apple and neither are as good. Sync NC with Google and away you go.
---
For any keyboard-only power users and/or RSI sufferers, [Homerow](https://www.homerow.app/) looks very cool
---
## Around the world
I always assumed things were going great down under but apparently not...
[Australia’s never-ending per capita recession](https://www.macrobusiness.com.au/2024/04/australias-never-ending-per-capita-recession/)
[Immigration and the housing crisis](https://www.thesaturdaypaper.com.au/news/economy/2024/05/11/immigration-and-the-housing-crisis)
_You only have to look at Australia’s performance over the past 20 years of this ‘big Australia’ experiment. Australia’s per capita GDP has fallen significantly, our productivity growth has collapsed, we have experienced capital shallowing, (because) if you grow your population faster than you can grow infrastructure, business investment and housing, you’re going to have less capital per worker,” he says._
Initially, it does look like Australian growth has stagnated
![](https://res.cloudinary.com/henrydashwood/image/upload/v1717381766/aus_gdp_per_capita_7dea40fa30.png)
But apparently this is mostly just exchange rates. In PPP with constant currency Australia has grown by 15% since 2008, Vs 10% for the UK and 17% for the US.
---
[Taiwan's Housing Crisis](https://alethios.substack.com/p/taiwans-housing-crisis)
_Taipei has only built 25,000 units in the last five years._
There's quite a lot in here about how Taiwan's land tax system is broken.
Apparently, rental yields are less than 2% in Taipei. The piece doesn't explain that but probably should.
---
[This Tooze piece](https://adamtooze.substack.com/p/chartbook-287-after-the-verdict-american) has some interesting quotes about the depth of US wealth in places you’ve never heard of
> _Auto dealers are one of the five most common professions among the top 0.1 percent of American earners. Car dealers, gas station owners, and building contractors, it turns out, make up the majority of the country’s 140,000 Americans who earn more than \$1.58 million per year. Crunching numbers from the U.S. Census Bureau, data scientist and author Seth Stephens-Davidowitz found that over 20 percent of car dealerships in the U.S. have an owner banking more than \$1.5 million per year. And car dealers are not only one of the richest demographics in the United States. They’re also one of the most organized political factions—a conservative imperium giving millions of dollars to politicians at local, state, and national levels._
> _These elites’ wealth derives not from their salary—this is what separates them from even extremely prosperous members of the professional-managerial class, such as doctors and lawyers - but from their ownership of assets. Those assets vary depending on where in the country we’re talking about; they could be a bunch of McDonald’s franchises in Jackson, Mississippi; a beef-processing plant in Lubbock, Texas; a construction company in Billings, Montana; commercial properties in Portland, Maine; or a car dealership in western North Carolina. Even the less prosperous parts of the United States generate enough surplus to produce a class of wealthy people. Depending on the political culture and institutions of a locality or region, this elite class might wield more or less political power. In some places, it has an effective stranglehold over what gets done; in others, it’s important but not all-powerful. …. An enormous number of organizations and institutions are dedicated to advancing the interests of this gentry class: chambers of commerce, exclusive country clubs and housing developments, the American Society of Concrete Contractors, and fruit growers’ associations, just to name a small cross-section. Through these organizations and their intimate ties to local and state politics, the gentry class can and usually does wield significant power to shape society to its liking. It’s easy to focus on the massive political spending of Sheldon Adelson or Michael Bloomberg; it’s harder, but no less important, to imagine what kind of deals about water rights or local zoning ordinances are being struck across the U.S. on the eighth green of the local country club._
It links to [this piece](https://slate.com/news-and-politics/2023/05/rich-republicans-party-car-dealers-2024-desantis.html) which had some interesting history of car dealerships but might need some salt
---
[NYC's Education Budget by the Numbers](https://www.maximumnewyork.com/p/nycs-education-budget-by-the-numbers)
_If you took a grand accounting of all the money that NYC spends per pupil, it would be much higher than discussed in this post (\$34,667 as of FY2022, according to the IBO)_
_Fully one-third of NYC’s annual operating (expense) budget goes to the DOE. This is about \$37.5 billion dollars, compared to the NYPD’s \$11 billion._
That seems insanely high. Britain's equivalent number is £7,460 according to [this](https://educationhub.blog.gov.uk/2024/03/19/school-funding-everything-you-need-to-know/). I wonder if London is much higher than the British average?
---
[How safe is SF](https://howsafeissf.com/)
Cool dataviz. Confirms everyone's preconceptions.
---
## Tech
https://x.com/wayve_ai/status/1787618605468704998
Some discussion in [this episode of the Autonocast]([https://podcasts.apple.com/gb/podcast/autonocast/id1168333433?i=1000655083284](https://podcasts.apple.com/gb/podcast/autonocast/id1168333433?i=1000655083284). The case seems to be that they are the best candidate to compete with Mobileye selling assisted driving tech to OEMs.
And the government have passed the [Automated Vehicles Act](https://www.gov.uk/government/news/self-driving-vehicles-set-to-be-on-roads-by-2026-as-automated-vehicles-act-becomes-law). Wayve and Oxa seem happy with this. I don't get where the 2026 date comes from though. Is the idea that companies can start the process of getting approval now and that the process takes 18 months? What actually are the concrete metrics/tests that a company as to pass?
---
[American AI group CoreWeave to invest £1bn in Britain](https://www.thetimes.co.uk/article/american-ai-group-coreweave-to-invest-1bn-in-britain-3fn7kzpgz)
---
[Scale AI chooses Britain for first international headquarters](https://www.thetimes.co.uk/article/scale-ai-chooses-britain-for-first-international-headquarters-sd57mqq2s)
---
https://x.com/stianwestlake/status/1796107522656309299
---
[_Due to GenAI and in-house built developer productivity tools, we have increased the output of our software developers by around 70% year-over-year and cut external developers by 60%._](https://www.bp.com/en/global/corporate/investors/results-reporting-and-presentations/quarterly-results-and-webcast.html)
---
[The Evolving Landscape of LLM Evaluation](https://newsletter.ruder.io/p/the-evolving-landscape-of-llm-evaluation)
---
[Platforms and Publishers: AI Partnership Tracker](https://petebrown.quarto.pub/pnp-ai-partnerships/)
---
[How to make more money renting a GPU than Nvidia makes selling it](https://www.nextplatform.com/2024/05/02/how-to-make-more-money-renting-a-gpu-than-nvidia-makes-selling-it/)
---
[The next iOS will have eye tracking](https://www.macrumors.com/2024/05/15/ios-18-accessibility-features/)
---
I've wanted a Remarkable or some other e-ink tablet for years but never actually needed one. [The new Daylight tablet looks gorgeous](https://x.com/jasonjoyride/status/1794428696939635011). But, as a quote tweet points out, this has the same sense of freshness and excitement as Roam Research in 2020...
---
[Emulating humans with NSFW chatbots](https://podcasts.apple.com/gb/podcast/latent-space-the-ai-engineer-podcast-practitioners/id1674008350?i=1000655829673)
It’s interesting how different the business model is from other generative AI companies because NSFW monetises so much. Still a bit baffled by the appeal.
---
Several years after [this piece](https://www.scientificamerican.com/article/israel-proves-the-desalination-era-is-here/) we finally have some updates on desalination progress:
- [The Growing Importance of Desalination](https://contrary.com/foundations-and-frontiers/desalination)
- [It’s 2024 and Drought is Optional](https://asteriskmag.com/issues/06/its-2024-and-drought-is-optional)
### EVs
[Vauxhall owner to sell cheap Chinese EVs in UK and mainland Europe](https://www.theguardian.com/business/article/2024/may/14/vauxhall-peugeot-stellantis-chinese-ev-europe-leapmotor-biden)
_Stellantis, which owns brands including Fiat, Peugeot and Vauxhall, will start selling two Leapmotor models in September, at prices of less than €20,000 (£17,200). UK sales will start in March 2025._
---
[China’s BYD closes in on deal to build all-electric London buses](https://www.thetimes.co.uk/article/chinas-byd-closes-in-on-deal-to-build-all-electric-london-buses-6qtdrv8z6)
_The Go-Ahead Group is set to award the company a contract to build more than 100 all-electric double-deckers at a price of about £400,000 each — £100,000 cheaper than UK competitors, sources said. It is the first time that BYD has won a contract to provide EV double-deckers in the UK, pipping local competitors such as Alexander Dennis._
_Sir Iain Duncan Smith, MP for Chingford in London and a former Conservative Party leader, lamented the decision to award the bus contract to BYD. “We’ve yet again gone to China to build buses. What is the matter with our domestic production? These are iconic, British London buses. Why is it that we simply do not look for a contractor based, if not in the UK, then certainly in Europe,” he said_
I think the answer is right there Sir Iain. We could probably close some of the gap by permitting more energy infrastructure. Remember we have the most expensive commercial energy in the world.
---
[New Kia EV3 is a £30k electric car with a 372-mile range](https://www.autoexpress.co.uk/kia/ev3/363257/new-kia-ev3-ps30k-electric-car-372-mile-range)
If the 30k version actually does that range this looks like a new price-to-range milestone
---
[Tesla makes push to roll out advanced FSD self-driving in China](https://www.reuters.com/business/autos-transportation/tesla-makes-push-roll-out-advanced-fsd-self-driving-china-2024-05-30/)
---
[New BYD Hybrid Can Drive Non-Stop for More Than 2,000 Kilometers](https://www.bloomberg.com/news/articles/2024-05-28/byd-shows-off-new-hybrid-powertrain-capable-of-ultra-long-drive)
## Science stuff that I can't judge the importance of
[AstraZeneca’s Tagrisso greatly slows cancer for some people with stage 3 lung cancer](https://www.statnews.com/2024/06/02/lung-cancer-tagrisso-astra-zeneca-asco/)
---
[World-first tooth-regrowing drug will be given to humans in September](https://newatlas.com/medical/tooth-regrowing-human-trial/)
---
[British-built ‘unhackable’ navigational system flown in world first](https://www.telegraph.co.uk/news/2024/05/13/british-built-unhackable-navigational-system-takes-off/)
## Fitness
I'm trying to improve my shoulder mobility. Some useful videos I've seen:
- [Instagram](https://www.instagram.com/p/C13Ivy2R7ct/)
- [Instagram](https://www.instagram.com/reel/C6Tkoc6vb7O/)
Keen for any other tips/routines
---
## Fashion
[My friend Theo is selling these Tweed Nehru gilets which I think look great](https://www.instagram.com/frederickhunterbespoke)
---
Fashion stopped changing for about a decade after the financial crash. But there seems to be a shift happening now. We're getting baggier and more high-wasted e.g.
https://x.com/bestofmescal/status/1796091525253771376
[https://www.atemporubato.com/](https://www.atemporubato.com/)
[https://www.instagram.com/reel/C7bjTdXoXDB/?igsh=amQyZXF3ZTc1OXVi](https://www.instagram.com/reel/C7bjTdXoXDB/?igsh=amQyZXF3ZTc1OXVi)
---
## People and Relationships
[How do I handle a friendship breakup?](https://www.avabear.xyz/p/dear-bear-how-do-i-handle-a-friendship)
---
[Looking for Rejection](https://www.avabear.xyz/p/looking-for-rejection)
---
[David Friedman on his parents](https://daviddfriedman.substack.com/p/mf-50a)
_When my parents got married, they decided that there were certain things that were difficult to say and should therefore be replaced by numbers. Only one survived in actual usage. In their family “number two” meant, in my family still means, “You were right and I was wrong.” One reason is that it is shorter, so easier to say. A second reason is that using the number reminds speaker and audience that admitting error is a difficult and virtuous thing to do, which makes it easier to do it. A third reason is that using a family code reminds the speaker that he is speaking to people who love him, so are unlikely to take advantage of the confession of error to put him down._
---
https://x.com/anaisisreading/status/1794917950874669299
---
Are running clubs the new dating apps?
https://x.com/lucyykt/status/1792271389245771951
---
## Miscellaneous
[Wagner in Africa](https://granta.com/wagner-in-africa/)
---
[The Last Freeminers of England](https://granta.com/the-last-freeminers-of-england/)
---
Nice [account](https://www.instagram.com/overintherover/) by a girl who is perpetually repairing her Land Rover. There's a part of me that wishes I knew more about engines but mostly I hope that the EV transition is just going to abstract this stuff away
---
[Plans approved for £61.8m redevelopment of Lord's](https://www.bbc.co.uk/sport/cricket/articles/cgrw3jxy0jdo). I don't get the stuff in here about Middlesex considering moving. Presumably, they're negotiating rent and want to generate some leverage.
---
https://x.com/t0nyyates/status/1788485421174845890
---
There are new [Eleven Labs](https://x.com/elevenlabsio/status/1788628171044053386?s=46) and [Suno](https://x.com/suno_ai_/status/1796273804991156326) music generation models out this month. They can now do proper 4-minute songs. I spent a day generating songs full of in-jokes and spamming group chats but haven't gone back. A big unlock for me would be if they can start generating background music indefinitely that has a particular vibe. e.g. Something that sounds like the Halt and Catch Fire soundtrack while I code, or the Köln Concert.
---
https://x.com/discussingfilm/status/1788556597767143744
Pretty low expectations for this, obviously. It's worth mentioning though that there is quite a charming [amateur film on Youtube](https://youtu.be/9H09xnhlCQU?si=-jl2XkWa8ZbQD9S3) on this subject. If you like it you might also like [this one about Arathorn](https://youtu.be/4l97GiM--jY?si=vuLg7iLoAy0mJVHo). Just 19 more years until Tolkien's works enter the public domain. Hopefully, we'll then see more stuff from people who "get it".
---
Nice [5-minute video](https://youtu.be/aZAhBbAmyo4?si=ko-yZ0rGefrobWY2) about San Francisco's Victorians and how the styles vary by decade
---
https://x.com/rhymerrigby/status/1789680608475492727
---
I’d hadn't seen a video of the Jetson, the vehicle that was the profiled in the [New Yorker flying car story](https://www.newyorker.com/magazine/2024/04/22/are-flying-cars-finally-here) last month [until now](https://www.instagram.com/reel/C6iXEfAst0z)
---
[Yes, People Still Buy Books](https://slate.com/culture/2024/04/book-sales-publishing-industry-statistics-substack-penguin-lawsuit.html)
_How a viral post got some key statistics wrong_
---
Probably not a good one to cite when making the case for “traditional architecture cheaper than modern architecture”… [https://www.smh.com.au/cbd/castle-s-still-in-the-air-for-scots-college-20230913-p5e4gk.html](https://www.smh.com.au/cbd/castle-s-still-in-the-air-for-scots-college-20230913-p5e4gk.html)
Although actually….80 million Australian dollars is 42 million pounds which is the same amount that Lambeth Palace spent on their incredibly cheap-looking library [https://anglicanmainstream.org/stratospheric-costs-of-ugly-new-lambeth-palace-library-need-explanation/](https://anglicanmainstream.org/stratospheric-costs-of-ugly-new-lambeth-palace-library-need-explanation/)
---
[New Zealand’s sheep-to-people ratio fell again in 2023](https://sherwood.news/world/new-zealands-sheep-to-people-ratio-fell-again-in-2023)
Meanwhile, the lamb price in Britain is really high. We've been getting £190 a lamb this year. Some discussion of why [here](https://www.fwi.co.uk/business/markets-and-trends/meat-prices/lamb-prices-hit-7-kg-at-abattoirs-and-likely-to-stay-high)
---
[Computer Scientists Invent an Efficient New Way to Count](https://www.quantamagazine.org/computer-scientists-invent-an-efficient-new-way-to-count-20240516/)
This is delightfully simple yet clever
---
[DNA confirms there IS a big cat roaming the British countryside](https://www.discoverwildlife.com/animal-facts/mammals/big-cat-british-countryside)
_The DNA of a big cat in the Panthera genus – probably a leopard – has been identified from a swab taken from a dead sheep in the Lake District. This is the first time that big cat DNA has been found on a carcass in the UK. The analysis was carried out at a laboratory at the University of Warwick run by Prof Robin Allaby._
---
[Cool piece on picture framing with examples of how it can improve a painting](https://www.apollo-magazine.com/peter-schade-national-gallery-london-framing-frames-interview/)
---
https://x.com/nev_in_color/status/1794082772790759597
---
[1898: The Birth of New York City](https://www.maximumnewyork.com/p/1898-the-birth-of-new-york-city)
Did you know Staten Island nearly seceded in the 90s and [there are still rumblings](https://www.silive.com/news/2019/11/forgotten-borough-no-more-borelli-moves-forward-with-plan-to-revive-island-secession-from-new-york-city.html)
> (In 1989), the state Legislature passed a measure signed by then Gov. Mario Cuomo authorizing a study and initiating the process for Staten Island to secede from New York City on the last day of its legislative session.
> By 1990, Staten Islanders voted overwhelmingly in favor — 83 percent — of a secession study and by 1991, Cuomo swore in a New York State Charter Commission for Staten Island.
> Two years later, in 1993, Staten Islanders approved — 65 percent — a non-binding referendum to secede from New York City and the state Senate also approved a secession bill.
> But those efforts came to a halt when former Assembly Speaker Sheldon Silver refused to allow a similar measure to be voted on in the Assembly without a “home rule message” from New York City.
> The city never held a secession vote and the measure for Staten Island to secede died in committee
[When Queens Tried To Secede](https://www.maximumnewyork.com/p/queens-secession)
---
[Singapore’s shophouses — hotter than Fifth Avenue?](https://www.ft.com/content/e1a53cb8-5bf0-408a-91a0-bcdd738c0f11)
---
[The Windows 10 desktop background is a real photo](https://gmunk.com/Windows-10-Desktop/)
---
[It's worth spending some time looking for the same product on other websites](https://linksiwouldgchatyou.substack.com/p/a-glitch-in-the-matrix-of-online)
---
https://x.com/thomasforth/status/1795939920952844465
Obviously a moot point in the real world where we're not joining, but worth pointing out.
To actually calculate something like this you would need to disentangle income from income (which would be pushed up) from output - which would be pushed up only insofar as the higher income was spent on location-based activity, and then you would need to estimate population flows, etc
]]>
https://www.henrydashwood.com/posts/24-05-links
https://www.henrydashwood.com/posts/24-05-linksFri, 24 May 2024 00:00:00 GMT<![CDATA[University of Waterloo]]>
https://www.henrydashwood.com/posts/university-of-waterloo
https://www.henrydashwood.com/posts/university-of-waterlooSat, 20 Apr 2024 00:00:00 GMT<![CDATA[Notes on Generative Auto-Didacticism]]>
https://www.henrydashwood.com/posts/notes-on-generative-auto-didacticism
https://www.henrydashwood.com/posts/notes-on-generative-auto-didacticismSun, 07 Apr 2024 00:00:00 GMT<![CDATA[Scrapy notes]]>
```
This creates a file structure like so:
```shell
├── scrapy.cfg
└──
├── __init__.py
├── items.py
├── middlewares.py
├── pipelines.py
├── settings.py
└── spiders
└── __init__.py
```
- **settings.py** is where project settings are contained, like activating pipelines, middlewares etc. You can change the delays, concurrency, and lots more things.
- **items.py** is a model for the extracted data. You can define a custom model (like a ProductItem) that will inherit the Scrapy Item class and contain your scraped data.
- **pipelines.py** is where the item yielded by the spider gets passed, it’s mostly used to clean the text and connect to file outputs or databases (CSV, JSON SQL, etc).
- **middlewares.py** is useful when you want to modify how the request is made and scrapy handles the response.
- **scrapy.cfg** is a configuration file to change some deployment settings, etc.
## Spiders
Scrapy provides several different spider types. Some of the most common ones:
- **Spider -** Takes a list of `start_urls` and scrapes each one with a `parse` method.
- **CrawlSpider -** Designed to crawl a full website by following any links it finds.
- **SitemapSpider -** Designed to extract URLs from a sitemap
To create a new generic spider, run:
```shell
scrapy genspider
```
A new spider will now have been added to your `spiders` folder, and it should look like this:
```python
import scrapy
class NAMEOFSPIDERSpider(scrapy.Spider):
name = 'NAMEOFSPIDER'
allowed_domains = ['website']
start_urls = ['website']
def parse(self, response):
pass
```
This spider class contains:
- **name** - an attribute that gives a name to the spider. We will use this when running our spider
- **allowed_domains** - an attribute that tells Scrapy that it should only ever scrape pages of the `` domain. This prevents the spider from going and scraping lots of websites. This is optional.
- **start_urls** - an attribute that tells Scrapy the first URL it should scrape.
- **parse** - this function is called after a response has been received from the target website.
To start using this Spider we will have to:
1. Change the `start_urls` to the URL we want to scrape
2. Insert our parsing code into the `parse` function
You run a spider with:
```shell
scrapy crawl
```
## Scrapy Shell
```shell
scrapy shell
```
If we run
```shell
fetch()
```
we should see a 200 response in the logs. Scrapy will save the HTML response in an object called `response`
You can get a list of elements matching a CSS selector by running
```shell
response.css("")
```
To just get the first matching element run
```shell
response.css("").get()
```
This returns all the HTML in this node of the DOM tree.
### CSS Selectors
]]>
https://www.henrydashwood.com/posts/scrapy-notes
https://www.henrydashwood.com/posts/scrapy-notesTue, 16 Jan 2024 00:00:00 GMT<![CDATA[The trapezium rule]]>
https://www.henrydashwood.com/posts/trapezium-rule
https://www.henrydashwood.com/posts/trapezium-ruleSat, 06 Jan 2024 00:00:00 GMT<![CDATA[The Art of Doing Science and Engineering]]> 0$. This means that $$\lim_{x\to-\infty}\frac{ka}{b}e^{bt} = 0$$
- At the upper limit $t = T$, so $$\frac{ka}{b}e^{bT}$$
- The definite integral is the difference between the antiderivative evaluated at these points. In this case, it's a very straightforward sum $$\frac{ka}{b}e^{bT} - 0 = \frac{ka}{b}e^{bT}$$
The process is exactly the same when finding the sum of knowledge up to 17 years ago, except our upper limit will be $\frac{ka}{b}e^{b(T - 17)}$.
So, to summarise:
$$
\begin{aligned}
\int_{-\infty}^{T} kae^{bt} \ dt &= \frac{ka}{b}e^{bT}\\
\int_{-\infty}^{T-17} kae^{bt} \ dt &= \frac{ka}{b}e^{b(T - 17)}
\end{aligned}
$$
Hamming's claim is that knowledge has been doubling every 17 years so we can say:
$$
\begin{aligned}
\frac{1}{2} &= \frac{\int_{-\infty}^{T-17} kae^{bt} \, dt}{\int_{-\infty}^{T} kae^{bt} \, dt}\\
\\
&= \frac{\frac{ka}{b}e^{b(T-17)}}{\frac{ka}{b}e^{bT}}\\
\\
&= \frac{e^{b(T-17)}}{e^{bT}}\\
\\
&= e^{b(T-17) - bT} \\
\\
&= e^{-17b} \\
\end{aligned}
$$
Above we are using the law of exponents that dividing exponential expressions with the same base is equivalent to subtracting their exponents.
Hamming estimates the length of a scientific career to be 55 years. Using his original equation for the number of scientists in a given year $y(t) = ae^{bt}$ we can divide the integral for the equation up to the current year by the integral of the equation up to 55 years ago.
$$
\begin{aligned}
\frac{\int_{T - 55}^{T}ae^{bt}dt}{\int_{-\infty}^{T}ae^{bt}dt} &= \frac{\frac{ka}{b}e^{bT} - \frac{ka}{b}e^{b(T - 55)}}{\frac{ka}{b}e^{bT} - 0}\\
\\
&= \frac{e^{bT} - e^{b(T - 55)}}{e^{bT}}\\
\\
&= 1 - e^{b(T - 55) - bT}\\
\\
&= 1 - e^{-55b}
\end{aligned}
$$
We can use our expression for the doubling of scientific knowledge $e^{-17b} = \frac{1}{2}$ to get the proportion of scientists alive today. We can use the law that $e^{kx} = (e^x)^k$.
$$
\begin{aligned}
e^{-17b} &= \frac{1}{2}\\
\\
\left(e^{-17b}\right)^\frac{55}{17} &= \left(\frac{1}{2}\right)^\frac{55}{17}\\
\\
e^{-17b \cdot \frac{55}{17}} &= \left(\frac{1}{2}\right)^\frac{55}{17}\\
\\
e^{-55b} &= \left(\frac{1}{2}\right)^\frac{55}{17}\\
\end{aligned}
$$
Substituting this back into the equation:
$$
\begin{aligned}
\frac{\int_{T - 55}^{T}ae^{bt}dt}{\int_{-\infty}^{T}ae^{bt}dt} &= 1 - \left(\frac{1}{2}\right)^\frac{55}{17}\\
\\
&= 0.894...
\end{aligned}
$$
This number is indeed very close to 90%.
Let's now come at the question from a different angle. Let's let $D$ be the doubling period and $L$ be the length of a scientific career.
The first equation becomes
$$
e^{-bD} = \frac{1}{2}
$$
and the second becomes
$$
\begin{aligned}
1 - e^{-bL} &= \frac{9}{10}\\
\\
1 - \left(\frac{1}{2}\right)^\frac{L}{D} &= \frac{9}{10}\\
\\
\left(\frac{1}{2}\right)^\frac{L}{D} &= \frac{1}{10}\\
\\
\ln\left(\left(\frac{1}{2}\right)^\frac{L}{D}\right) &= \ln\left(\frac{1}{10}\right)\\
\\
\frac{L}{D} \cdot \ln\left(\frac{1}{2}\right) &= \ln\left(\frac{1}{10}\right)\\
\\
\frac{L}{D} &= \frac{\ln\left(\frac{1}{10}\right)}{\ln\left(\frac{1}{2}\right)}\\
\\
\frac{L}{D} &= \frac{\ln(1) - \ln(10)}{\ln(1) - \ln(2)}\\
\\
\frac{L}{D} &= \frac{-\ln(10)}{-\ln(2)}\\
\\
\frac{L}{D} &= \frac{\ln(10)}{\ln(2)}\\
\\
\frac{L}{D} &= \log_{2}(10)\\
\\
&= 3.3219...
\end{aligned}
$$
Multiplying 3.3219 by our supposed doubling period of 17 years gives us 56.47 years for the average length of a scientific career, very close to Hamming's estimate of 55 years.
## Chapter 2
In this chapter, Hamming discusses growth models. The simplest growth model assumes the growth rate is proportional to the current size. For instance, in the case of compound interest. We can describe this model with a differential equation.
$$
\frac{dy}{dt} = ky
$$
A differential equation is an equation that relates a function to its derivatives. In the context of growth models, differential equations are used to describe how something changes over time. The equation above is a first-order differential equation where $\frac{dt}{dy}$ represents the rate of change of $y$ with respect to time $t$, and $ky$ suggests that this rate of change is proportional to the current value of $y$. Here, $k$ is a constant of proportionality.
The solution to a differential equation is a function (or a set of functions) that satisfies the equation. This means that if you take the solution and its derivatives and plug them back into the original differential equation, the equation will hold. In other words, the left-hand side of the equation will equal the right-hand side for all points in the domain of the solution.
Hamming tells us the solution to the equation but skips over how to derive it. We do it like so:
1. We start by rearranging the equation so that each variable is on a different side of the equation. $$\frac{1}{y} \cdot dy = k \cdot dt$$
2. Next we integrate both sides of the equation $$\ln(y) = kt + C$$
3. We can then exponentiate both sides of the equation to get rid of the natural logarithm. $$e^{\ln(y)} = e^{kt + C}$$
4. This simplifies to $$y = e^{kt} \cdot e^{C}$$
5. Since $e^C$ is just a constant we can represent it as just $A$. Thus we get the solution given by Hamming: $$y(t) = Ae^{kt}$$
We can think of $A$ as representing the initial condition of the system. The equation $y(t) = Ae^{kt}$ then tells us how the quantity $y$ changes over time. If $k > 0$ we have growth. If $k < 0$ we have decay.
We can verify that this is a solution by:
1. Differentiating the solution such that it is equal to the left-hand side of the differential equation (NB the derivate of $e^{kt}$ is $ke^{kt}$) $$\frac{dy}{dt} = kAe^{kt}$$
2. Substituting the right-hand side of the solution into the right-hand side of the differential equation $$ky = k(Ae^{kt})$$
We see that both sides of the equation match.
Hamming now updates this model of growth to include a limiting factor $L$.
$$
\frac{dy}{dt} = ky(L-y)
$$
Hamming "reduces" the equation to a standard form, meaning we don't have to write the constants. He says let $y = Lz$ and $x = t(kL)$. Note that [there is a typo in the book](https://math.stackexchange.com/questions/3738219/change-of-variables-in-basic-differential-equation-from-hammings-art-of-doing-s) where they've written $\frac{t}{kL^2}$So substituting those in we get:
$$
\begin{aligned}
\frac{dy}{dt} &= kLz(L - Lz) \\
&= kL^{2}z(1 - z)
\end{aligned}
$$
We can get $\frac{dy}{dt}$ in terms of $\frac{dz}{dt}$ by differentiating $y = Lz$ with respect to $t$: $$\frac{dy}{dt} = L\frac{dz}{dt}$$
Given $x = t(kL)$ we can find $\frac{dx}{dt}$:
$$
\begin{aligned}
x &= t(kL) \\
\frac{dx}{dt} &= kL
\end{aligned}
$$
We can use this to express $\frac{dz}{dt}$ in terms of $\frac{dz}{dx}$. The chain rule states that if we have a function $z(x(t))$, the derivative of $z$ with respect to $t$ will be $\frac{dz}{dt} = \frac{dz}{dx} \cdot \frac{dx}{dt}$. So we can say that:
$$
\begin{aligned}
\frac{dz}{dt} &= \frac{dz}{dx} \cdot \frac{dx}{dt} \\
&= \frac{dz}{dx} \cdot kL
\end{aligned}
$$
Going back to the earlier equation $\frac{dy}{dt} = L\frac{dz}{dt}$, we can now say:
$$
\begin{aligned}
\frac{dy}{dt} &= L\frac{dz}{dt} \\
kL^{2}z(1 - z) &= L (\frac{dz}{dx} \cdot kL) \\
&= \frac{dz}{dx} \cdot kL^2 \\
\frac{dz}{dx} &= z(1 - z) \\
\end{aligned}
$$
This is the standard form derived by Hamming.
Suppose we wanted to integrate this equation to find $z$ in terms of $x$. We might first rearrange it to separate the variables so it looks like this: $$\frac{1}{z(1 - z)}dz = dx$$The left-hand side is a complex fraction. To make it easier to integrate, Hamming uses partial fractions. This means:
1. Expressing $\frac{1}{z(1-z)}$ as a sum of simpler fractions $\frac{A}{z}$ and $\frac{B}{1-z}$
2. Multiplying through the common denominator $z(1-z)$
3. Setting $z$ to various values to solve for $A$ and $B$. In this case, we will use 0 and 1
$$
\begin{aligned}
\frac{1}{z(1-z)} &= \frac{A}{z} + \frac{B}{1-z} \\
1 &= A(1 - z) + Bz \\
\\
1 &= A(1 - 0) + B \cdot 0 \\
A &= 1\ \ \ \text when\ z = 0 \\
\\
1 &= A(1 - 1) + B \cdot 1 \\
B &= 1\ \ \ \text when\ z = 1 \\
\\
\frac{1}{z(1-z)} &= \frac{1}{z} + \frac{1}{1-z} \\
\end{aligned}
$$
This is much simpler to integrate. We know that the derivative of $\ln(x)$ is $\frac{1}{x}$ so $\int{\frac{1}{z}} = \ln(z)$. We have to remember to apply the chain rule when integrating $\frac{1}{1 - z}$ though. We can do this with substitution.
$$
\begin{aligned}
u &= 1 - z \\
du &= -dz \\
dz &= -du \\
\int{\frac{1}{1 - z}} &= \int{\frac{1}{u} \cdot -du} \\
&= -\int{\frac{1}{u}du} \\
&= -\ln(u) + C \\
&= -ln(1 - z) + C
\end{aligned}
$$
Therefore in summary:
$$
\begin{aligned}
\int{\frac{1}{z} + \frac{1}{1 - z} dz} &= \int{dx} \\
\\
\ln{(z)} - \ln{(1 - z)} &= x + C
\end{aligned}
$$
We can use the law of logarithms that $\ln(x) - \ln(y) = \ln(\frac{x}{y})$. So:
$$
\begin{aligned}
\ln(\frac{z}{1 - z}) &= x + C \\
\frac{z}{1 - z} &= e^{x + C}
\end{aligned}
$$
Since $e^{x+C} = e^x \cdot e^C$ and $e^C$ is just a constant, we can replace it with a new constant which we'll call $A$. So we now have:
$$
\begin{aligned}
\frac{z}{1 - z} &= Ae^x \\
\end{aligned}
$$
We can solve for $z$ like so:
$$
\begin{aligned}
\frac{z}{1 - z} &= Ae^x \\
z &= Ae^x(1 - z) \\
z &= Ae^x - Ae^x \cdot z \\
z + Ae^x \cdot z &= Ae^x \\
z(1 + Ae^x) &= Ae^x \\
z &= \frac{Ae^x}{1 + Ae^x}
\end{aligned}
$$
To get the answer in the form given by Hamming we can divide the numerator and denominator by $Ae^x$
$$
\begin{aligned}
z &= \frac{Ae^x}{1 + Ae^x} \\
\\
&= \frac{\frac{Ae^x}{Ae^x}}{\frac{1}{Ae^x} + \frac{Ae^x}{Ae^x}} \\
\\
&= \frac{1}{1 + \frac{1}{Ae^x}} \\
\\
&= \frac{1}{1 + (\frac{1}{A})e^{-x}}
\end{aligned}
$$
As Hamming points out, $A$ is determined by the initial conditions. By this, he means where you set $t$ or $x$ equal to 0. As $x$ approaches $-\infty$, the denominator will get larger and $z$ will approach 0. As it gets bigger, $(\frac{1}{A})e^{-x}$ will approach 0 and $z$ will approach 1.
Hamming shows us a more flexible model for growth $$\frac{dz}{dx} = z^a(1 - z)^b,\ \ (a, b > 0)$$
We can plot growth curves for different values of $a$ and $b$ to see how they change how the model behaves:
![](https://res.cloudinary.com/henrydashwood/image/upload/v1702034648/small_Pasted_image_20231208111816_cee46915e5.png)
We can find $z$ by separation of variables and integration. We can also find the steepest slope by differentiating the right-hand side and setting it equal to 0. To differentiate we use the product rule: $$\frac{d(uv)}{dz} = u \cdot \frac{dv}{dz} + v \cdot \frac{du}{dz}$$Hence:
$$
\begin{aligned}
\frac{d}{dz}[z^a(1 - z)^b] &= a \cdot z^{a-1} \cdot (1 -z)^b + z^a \cdot b \cdot (1 - z)^{b - 1} \cdot (-1) = 0 \\
&= a \cdot z^{a-1} \cdot (1 -z)^b - z^a \cdot b \cdot (1 - z)^{b - 1} = 0\\
&= z^{a - 1} \cdot (1 - z)^{b - 1} \cdot (a(1 - z) - bz) = 0 \\
&= a(1 - z) - bz = 0
\end{aligned}
$$
Notice how we can factor out the terms $z^{a-1}$ and $(1 - z)^{b-1}$ in line 3 above. It took me a while to see this but it's obvious when you think about it that e.g. $x^{y - 1} * x = x^y$.
From here it's easy to solve for $z$:
$$
\begin{aligned}
a(1 - z) - bz &= 0 \\
a - az - bz &= 0 \\
a - z(a + b) &= 0 \\
a &= z(a + b) \\
z &= \frac{a}{a + b}
\end{aligned}
$$
Substituting this value of $z$ back into the original differential equation $\frac{dz}{dx} = z^a(1 - z)^b$ gives us
$$
\begin{aligned}
\frac{dz}{dx} &= \left(\frac{a}{a + b}\right)^a\left(1 - \frac{a}{a + b}\right)^b \\
&= \left(\frac{a}{a + b}\right)^a\left(\frac{a + b}{a + b} - \frac{a}{a + b}\right)^b \\
&= \left(\frac{a}{a + b}\right)^a\left(\frac{b}{a + b}\right)^b \\
&= \frac{a^ab^b}{(a+b)^{a+b}} \\
\end{aligned}
$$
This expression represents the slope of the curve at the point $z = \frac{a}{a + b}$ which is the steepest point of the curve. In the context of a growth model, this is the maximum growth rate.
Hamming draws our attention to two special cases. When $a = b$, the maximum slope will be:
$$
\begin{aligned}
\frac{a^ab^b}{(a+b)^{a+b}} &= \frac{a^aa^a}{(a+a)^{a+a}} \\
&= \frac{a^{2a}}{(2a)^{2a}} \\
&= \frac{a^{2a}}{2^{2a}a^{2a}} \\
&= \frac{1}{2^{2a}} \\
&= 2^{-2a} \\
\end{aligned}
$$
When $a = b = \frac{1}{2}$ our differential equation will be
$$
\begin{aligned}
\frac{dz}{dx} &= z^a(1 - z)^b \\
&= z^\frac{1}{2}(1 - z)^\frac{1}{2} \\
&= \sqrt{z(1 - z)} \\
\frac{dz}{\sqrt{z(1 - z)}} &= dx \\
\end{aligned}
$$
We can integrate this by making a trigonometric substitution $z = \sin^2(\theta)$. Differentiating this with the chain rule tells us that $\frac{dz}{d\theta} = 2\sin(\theta)\cos(\theta)$ and $dz = 2\sin(\theta)\cos(\theta)d\theta$. Substituting this back into the differential equation gives:
$$
\begin{aligned}
\frac{2\sin(\theta)\cos(\theta)d\theta}{\sqrt{\sin^2(\theta)(1 - \sin^2(\theta))}} &= dx \\
\frac{2\sin(\theta)\cos(\theta)d\theta}{\sqrt{\sin^2(\theta)\cos^2(\theta)}} &= dx \\
\frac{2\sin(\theta)\cos(\theta)d\theta}{\sin(\theta)\cos(\theta)} &= dx \\
2d\theta &= dx \\
\int{2d\theta} &= \int{dx} \\
2\theta &= x + C \\
\theta &= \frac{x + C}{2} \\
\end{aligned}
$$
Having found $\theta$, we can substitute it back into $z = \sin^2(\theta)$ to get:
$$z = \sin^2(\frac{x}{2} + C), (-C \le \frac{x}{2} \le \frac{\pi}{2} - C)$$
Hamming tells us that the solution curve has a finite range. We can see that because $\sin^2(\theta)$ is always within 0 and 1. The solution is valid for $\theta$ such that $\sin(\theta)$ is real and non-negative. Hence the bounds $-C \le \frac{x}{2} \le \frac{\pi}{2} - C$.
## Chapter 9
Hamming begins chapter 9 by reminding us that we can extend the Pythagorean theorem into higher dimensions because the square of the diagonal is the sum of the squares of the individual mutually perpendicular sides $$D^2 = \sum^n_{i=1}{x^2_i}$$ where $x_i$ are the lengths of the sides of the rectangular block in $n$ dimensions.
### The Stirling Approximation
Next, he derives the Stirling approximation for $n!$. This is especially useful for large factorials. It also becomes increasingly accurate as $n$ increases. He starts by taking the natural log of $n!$ to get $$\ln(n!) = \sum^n_{k=1}{\ln(k)}$$
He then finds the integral $\int^n_1\ln(x)dx$ by using integration by parts. This is a technique that comes from the product rule of differentiation. It is given by the formula $$\int{udv} = uv - \int{vdu}$$
Hamming sets $u = \ln{x}$ and $dv = dx$. It therefore follows that $du = \frac{1}{x}dx$ and $v = \int{dv} = \int{dx} = x$. Substituting this into the integration by parts formula we get:
$$
\begin{aligned}
\int^n_1{\ln(x)dx} &= \ln(x)x - \int{x}\frac{1}{x}dx \\
&= \ln(x)x - \int{1dx} \\
&= \ln(x)x - x \\
&= (n\ln(n) - n) - (1\ln(1) - 1) \\
&= n\ln(n) - n + 1
\end{aligned}
$$
Hamming also shows us how we could use the trapezium rule to approximate the integral. (See my trapezium rule notes for how we get this formula).
$$
\int^n_1{\ln{x}dx} \approx \frac{1}{2}\ln{1} + \ln{2} + \ln{3} +\ ...\ + \frac{1}{2}\ln{n}
$$
Note that he appears to be assuming that we have divided the curve into $n - 1$ segments which would result in our term for the width of the trapeziums $\Delta x$ being equal to 1. That would explain why we don't see it in the equation above
Since $\ln{1} = 0$, we can simplify this to $$\int^n_1{\ln{x}dx} \approx \ln{2} + \ln{3} +\ ...\ + \frac{1}{2}\ln{n}$$
It is a property of logarithms that the sum of logarithms is approximately equal to the logarithm of the product of terms. Thus the sum of $\ln{2} + \ln{3} +\ ...\ + \frac{1}{2}\ln{n}$ can be approximated as $\ln(n!)$.
The Stirling approximation of $n!$ is $n^n e^{-n} \sqrt{2\pi n}$. Taking the log of this gets us: $$ln(n!) \approx n\ln(n) - n + \ln(\sqrt{2 \pi n})$$
The term $\ln{\sqrt{2\pi n}}$ is often neglected in rough approximations, leading to: $$ln(n!) \approx n\ln(n) - n$$
Hamming adds a term $\frac{1}{2}\ln{n}$ to account for the half contribution of the endpoint $n$. He there is also a term $+1$ in his final result. ChatGPT suggests that it may be an adjustment or correction factor to improve the accuracy of the approximation for specific ranges of $n$. In some numerical approximations, especially when dealing with sums and series, such correction factors are introduced to fine-tune the approximation, particularly for smaller values of $n$ where Stirling's approximation (which is more accurate for large $n$) may not be as precise. Either way
$$
\sum^n_{k=1}\ln{k} \approx n\ln{n} - n + 1 + \frac{1}{2}\ln{n}
$$
Undoing the logs by taking the exponential of each side gives:
$\ln{n}$ to both terms, we get, finally:
$$
\sum^n_{k=1}\ln{k} \approx n\ln{n} - n + 1 + \frac{1}{2}\ln{n}
$$
Undoing the logs by taking the exponential of each side gives: $$n! \approx Cn^ne^{-n}\sqrt{n}$$
$C$ is a constant (not far from $e$) independent of $n$ since we are approximating an integral by the trapezium rule and the error in the trapezium approximation increases more slowly as $n$ grows larger, and as $C$ is the limiting value.
This is the first form of Stirling's formula. Hamming skips deriving the limiting, at infinity, value of $C$ which is $\sqrt{2\pi} = 2.5066...$ ($e = 2.71828...$). However, doing so would show us how we get the usual Stirling's formula for the factorial $$n! \approx n^ne^{-n}\sqrt{2 \pi n}$$
Hamming provides the following table to give us a sense of the quality of the Stirling approximation.
$$
\begin{array}{l l l l}
\hline
n & \text{Stirling} & \text{True} & \text{Stirling/True} \\
\hline
1 & 0.92214 & 1 & 0.92214 \\
2 & 1.91900 & 2 & 0.95950 \\
3 & 5.83621 & 6 & 0.97270 \\
4 & 23.50618 & 24 & 0.97942 \\
5 & 118.01917 & 120 & 0.98349 \\
6 & 710.07818 & 720 & 0.98622 \\
7 & 4980.3958 & 5040 & 0.98817 \\
8 & 39902.3955 & 40320 & 0.98964 \\
9 & 359536.87 & 362880 & 0.99079 \\
10 & 3598695.6 & 3628800 & 0.99170 \\
\hline
\end{array}
$$
He notes that as the numbers get larger, the ratio approaches 1 but the absolute differences get greater. Consider the two functions:
$$
\begin{aligned}
f(n) &= n + \sqrt{n} \\
g(n) &= n
\end{aligned}
$$
The limit of the ratio $\frac{f(n)}{g(n)}$, as $n$ approaches infinity, is 1. But the difference $f(n) - g(n) = \sqrt{n}$ grows larger as $n$ increases.
### Extending the factorial function to all positive real numbers
Hamming introduces the _gamma function_ in the form of the integral
$$
\Gamma(n) = \int^\infty_0{x^{n-1}e^{-x}dx}
$$
which he tells us converges for all $n > 0$.
For $n > 1$ we integrate by parts again. We use
$$
\begin{aligned}
dv &= e^{-x} \\
u &= x^{n-1}
\end{aligned}
$$
Hamming tells us that at the two limits, the integrated part is 0. This is because as $x \to \infty$ $e^{-x}$ tends towards 0 while as $x \to 0$ $x^{n-1}$ will tend towards 0 (remember this is for $n > 1$).
The integration by parts formula is:
$$
\int{udv} = uv - \int{vdu}
$$
We can also quickly work out that
$$
\begin{aligned}
du &= (n - 1)x^{n - 2}dx \\
v &= -e^{-x}
\end{aligned}
$$
Hamming tells us that at the limits where the integrated part is 0 we have the reduction formula:
$$
\Gamma(n) = (n - 1)\Gamma(n - 1)
$$
with $\Gamma(1) = 1$
]]>
https://www.henrydashwood.com/posts/the-art-of-doing-science-and-engineering
https://www.henrydashwood.com/posts/the-art-of-doing-science-and-engineeringTue, 14 Nov 2023 00:00:00 GMT<![CDATA[Microeconomics for managers chapter 2]]> 1). So B must choose between trust, getting -1 for itself, and no trust, which nets it 0. It will not trust A, and A will have no opportunity to move.
## 2.7
**Imagine two firms, labeled $A$ and $B$, producing products that are substitutes but not perfect substitutes. The inverse demand functions for their two goods are $p_A = a - x_A - bx_B$ and $p_B = a - x_B - bx_A$ for a positive constant $a$ and for $0 < b < 1$, with the same constants $a$ and $b$ appearing in both inverse demand functions. Each firm has a constant marginal cost of production $c$.**
## (a)
**Suppose the two firms must simultaneously and independently choose quantities to produce, each without knowing what the other has chosen. What are (or is) the Nash equilibria of this game?**
In plain English, the inverse demand function $p_A = a - x_A - bx_B$ says that the price $p$ firm $A$ can sell it's good is determined by:
- The postive constant $a$. This represents the intercept of the inverse demand curve. It could be interpreted as the maximum price consumers are willing to pay when no units of either good are produced.
- The quantity of the good firm $A$ produces is given by the term $x_A$. This value is negative as the more of a good is produced, the lower will be its price.
- The quantity of the good firm $B$ produces is given by the term $x_B$.This value is negative for the same reason as $x_A$. It is mutliplied by the term $b$ which effectively weights the effect of $x_B$ by how similar the two goods are to each other. i.e. if the two goods are actually quite dissimilar, the effect of firm $B$ making more will be quite small.
We want to know to know the equilibrium values for $x_A$ and $x_B$.
Let's start by writing down a pair of equations to describe each firm's profit, the profit functions. Intially we could say that each firm's profit will be the price they sell their goods minus the cost of manufacturing them, all multiplied by the quantity that is manufactured:
$$
\pi_A = (p_A - c)x_A \\
\pi_B = (p_B - c)x_B
$$
Now as described in the question above, the prices of $A$ and $B$'s goods are given by their inverse demand functions. So we can subsitute them into the profit functions:
$$
\begin{aligned}
\pi_A &= (a - x_A - bx_B - c)x_A \\
&= a \cdot x_A - {x_A}^2 - bx_B \cdot x_A - c \cdot x_A \\
&= (a - bx_B - c)x_A - {x_A}^2 \\
\\
\pi_B &= (a - x_B - bx_A - c)x_B \\
&= a \cdot x_B - {x_B}^2 - bx_A \cdot x_B - c \cdot x_B \\
&= (a - bx_A - c)x_B - {x_B}^2
\end{aligned}
$$
In order to maximise their profits, each firm will produce a quantity such that it would make make less profit if it made any more or any less. If we imagine plotting the profit functions for various quantities, the peaks of the curves will be where their derivatives are 0.
So we can find out what those quantities $x_A$ and $x_B$ will be by calculating the derivatives, setting them equal to 0, and solving for for their respective own quantity terms. These are known as reaction functions (and also as first-order conditions for profit maximisation) as they describe the the quantity a firm will produce to maximise its profit in response to the quantity produced by the other firm.
$$
\begin{aligned}
{\pi_A}' &= a - bx_B - c - 2x_A \\
0 &= a - bx_B - c - 2x_A \\
x_A &= \frac{a - bx_B - c}{2} \\
\\
{\pi_B}' &= a - bx_A - c - 2x_B \\
0 &= a - bx_A - c - 2x_B \\
x_B &= \frac{a - bx_A - c}{2}
\end{aligned}
$$
Finally to find the Nash equilibrium it we solve the reaction functions simultaneously. We'll substitute the reaction function for x_A into the reaction function for $x_B$ and solve for $x_B$.
$$
\begin{aligned}
x_B &= \frac{(a - c)}{2} - \frac{b(\frac{a - bx_B - c}{2})}{2} \\
&= (\frac{a}{2} - \frac{c}{2}) + (-\frac{ab}{4} + \frac{bc}{4} + \frac{b^2x_B}{4}) \\
&= \frac{a - c}{2} - \frac{b(a - c)}{4} + \frac{b^2x_B}{4} \\
x_B - \frac{b^2x_B}{4} &= \frac{a - c}{2} - \frac{b(a - c)}{4} \\
x_B(1 - \frac{b^2}{4}) &= \frac{a - c}{2} - \frac{b(a - c)}{4} \\
x_B &= \frac{\frac{a - c}{2} - \frac{b(a - c)}{4}}{1 - \frac{b^2}{4}} \\
&= \frac{\frac{2(a - c) - b(a - c)}{4}}{1 - \frac{b^2}{4}} \\
&= \frac{\frac{(2 - b)(a - c)}{4}}{1 - \frac{b^2}{4}} \\
&= \frac{\frac{(2 - b)(a - c)}{4}}{\frac{4 - b^2}{4}} \\
&= \frac{(2 - b)(a - c)}{4 - b^2} \\
&= \frac{(2 - b)(a - c)}{(2 + b)(2 - b)} \\
&= \frac{a - c}{b + 2}
\end{aligned}
$$
We then can then subsitute our result for $x_B$ into the reaction function for $x_A$.
$$
\begin{aligned}
x_A &= \frac{a - c}{2} - \frac{b(a - c)}{2(b + 2)} \\
&= \frac{(a - c)(b + 2) - b(a - c)}{2(b + 2)} \\
&= \frac{ab + 2a - bc - 2c - ab + bc}{2(b + 2)} \\
&= \frac{2a - 2c}{2(b + 2)} \\
&= \frac{2(a - c)}{2(b + 2)} \\
&= \frac{a - c}{b + 2}
\end{aligned}
$$
This implies that in the Nash equilibrium, both firms will produce the same quantity of output, which is given by the expression $\frac{a - c}{b + 2}$. This result is consistent with the symmetric nature of the Cournot competition model when the firms have identical cost structures and face the same demand conditions.
We can plot a visualisation of this result like so. Note that in this plot we are assuming that $a = 10$, $b = 0.5$, and $c = 2$.
![](https://res.cloudinary.com/henrydashwood/image/upload/v1697377829/image_20230924210650392_4726534b03.png)
What is this showing us?
As the quantity produced by firm $B$ decreases, the optimal quantity for firm $A$ to make increases. If firm $B$ makes nothing at all the optimal quantity for firm A to make is:
$$
\begin{aligned}
x_A &= \frac{a - bx_B - c}{2} \\
&= \frac{a - b \cdot 0 - c}{2} \\
&= \frac{a - c}{2}
\end{aligned}
$$
Substituting our example values gives us $\frac{10 - 2}{2} = 4$ and indeed we can see that $x_A$ is 4 when $x_B$ is 0.
As the amount produced by firm $B$ increases, the optimal quantity form firm $A$ to produce decreases. At some point the optimal quantity for firm $A$ to make will be 0. Setting $x_A$ to 0 and rearranging to solve for $x_B$ shows us how much firm $B$ would have to make for this to be the case.
$$
\begin{aligned}
x_A &= \frac{a - bx_B - c}{2} \\
0 &= \frac{a - bx_B - c}{2} \\
0 &= a - bx_B - c \\
bx_B &= a - c \\
x_B &= \frac{a - c}{b}
\end{aligned}
$$
Substituting in our example values gives us $\frac{10 - 2}{0.5} = 16$ and indeed we can see that when $x_B$ is 16 $x_A$ is 0.
Of course, the same principles hold if with swap $A$ and $B$ around.
## (b)
**Suppose that the two firms must simultaneously and independently choose prices to charge, each without knowing what price the other has chosen. What are (or is) the Nash equilibria of this game?**
First we find invert the inverse demand functions to get the demand functions.
$$
p_A = a - x_A - bx_B \\
p_B = a - x_B - bx_A
$$
We start by isolating the $x$ terms in each equation
$$
x_A = a - p_A - bx_B \\
x_B = a - p_B - bx_A
$$
We can then substitute the expression for $x_B$ into the expression for $x_A$
$$
\begin{aligned}
x_A &= a - p_A - b(a - p_B - bx_A) \\
&= a - p_A - ab + bp_B + b^2x_A \\
x_A - b^2x_A &= a - p_A - ab - bp_B \\
x_A(1 - b^2) &= a - p_A - ab + bp_B \\
x_A &= \frac{a - p_A - ab + bp_B}{1 - b^2} \\
x_A &= \frac{a(1 - b) - p_A + bp_B}{1 - b^2}
\end{aligned}
$$
We can also say by symmetry that
$$
x_B = \frac{a(1 - b) - p_B + bp_A}{1 - b^2}
$$
We should also re-note the profit equations for each firm
$$
\pi_A = (P_A - c)x_A \\
\pi_B = (P_B - c)x_B
$$
Each firm will choose the price that maximises its profits given the price chosen by the other firm. We can substitute the demand functions that we have just derived into the profit functions
$$
\begin{aligned}
\pi_A &= (P_A - c)(\frac{a(1 - b) - p_A + bp_B}{1 - b^2}) \\
&= \frac{a(1 - b)(P_A - c) - p_A(P_A - c) + bp_B(P_A - c)}{1 - b^2} \\
&= \frac{a(p_A - c - bP_A + bc) - {p_A}^2 + cP_A + bp_BP_A - cbp_B}{1 - b^2} \\
&= \frac{ap_A - ac - abP_A + abc - {p_A}^2 + cP_A + bp_BP_A - cbp_B}{1 - b^2} \\
&= \frac{c(-a + ab - bp_B) + p_A(a - ab + c + bp_B) - {p_A}^2}{1 - b^2} \\
&= \frac{c(a(b - 1) - bp_B) + p_A(a(1 - b) + bp_B + c) - {p_A}^2}{1 - b^2} \\
\end{aligned}
$$
As in the last question we can find these "first order conditions for profit maximisation" by differentiating the profit functions with respect to the prices $P_A$ and $P_B$, and setting the derivatives equal to zero. First the derivative. To solve this we will need to make use of the quotient rule:
$$
\frac{d}{dx}(\frac{f(x)}{g(x)}) = \frac{f'(x)g(x) - f(x)g'(x)}{g(x)^2}
$$
A this point I'm going to admit defeat regarding doing it by hand. Here's a way you can get the derivative using the Sympy library in Python
```python
import sympy
pA, pB, a, b, c = sympy.symbols('pA pB a b c')
expression = (c*(a*(b - 1) - b*pB) + pA*(a*(1 - b) + b*pB + c) - pA**2)/(1 - b**2)
derivative = expression.diff(pA)
sympy.simplify(derivative)
```
What you'll get if you run this is the following expression:
$$
\frac{2p_A + a(b-1) - bp_B - c}{b^2 - 1}
$$
And now, setting the derivate equal to zero
$$
\begin{aligned}
\frac{2p_A + a(b-1) - bp_B - c}{b^2 - 1} &= 0 \\
2p_A + a(b-1) - bp_B - c &= 0 \\
2p_A &= -a(b - 1) + c + bp_B \\
2p_A &= a - ab + bp_B + c \\
2p_A &= a(1 - b) + bp_B + c \\
p_A &= \frac{a(1 - b) + bp_B + c}{2} \\
\end{aligned}
$$
Because the firms respective functions are identical we can declare by symmetry that
$$
p_A = \frac{a(1 - b) + bp_B + c}{2} \\
p_B = \frac{a(1 - b) + bp_A + c}{2}
$$
As in the last question, to find the Nash equilibrium we have to solve these equations simulataneously. This time the algebra is even more of a nightmare to keep track of by hand so lets use a tool.
[Wolfram Alpha has a tool for solving systems of equations here](https://www.wolframalpha.com/input?i=systems+of+equations+calculator&assumption=%7B%22F%22%2C+%22SolveSystemOf4EquationsCalculator%22%2C+%22equation1%22%7D+-%3E%22x+%3D+%28a%281+-+b%29+%2B+b*y+%2B+c%29%2F2%22&assumption=%7B%22F%22%2C+%22SolveSystemOf4EquationsCalculator%22%2C+%22equation4%22%7D+-%3E%22%22&assumption=%22FSelect%22+-%3E+%7B%7B%22SolveSystemOf2EquationsCalculator%22%7D%7D&assumption=%7B%22F%22%2C+%22SolveSystemOf4EquationsCalculator%22%2C+%22equation2%22%7D+-%3E%22y+%3D+%28a%281+-+b%29+%2B+b*x+%2B+c%29%2F2%22&assumption=%7B%22F%22%2C+%22SolveSystemOf4EquationsCalculator%22%2C+%22equation3%22%7D+-%3E%22%22).
We can also use Sympy
```python
import sympy as sp
pA, pB, a, b, c = sp.symbols('pA pB a b c')
eq1 = sp.Eq(pA, (a*(1 - b) + b*pB + c)/2)
eq2 = sp.Eq(pB, (a*(1 - b) + b*pA + c)/2)
solution = sp.solve((eq1, eq2), (pA, pB))
```
The solution from Sympy which can be multiplied by -1 to be the same as the solution in the textbook
$$
\begin{aligned}
P^*_A = P^*_B &= \frac{ab - a - c}{b - 2} \\
&= \frac{-ab + a + c}{- b + 2} \\
&= \frac{a -ab + c}{2 - b} \\
&= \frac{a(1 - b) - c}{2 - b} \\
\end{aligned}
$$
We can visualise this. This plot shows pairs of prices each firm. Each line shows the best price of each firm to the corresponding price of the other firm. The place they intersect is the Nash equilibrium. Once again we assume that $a = 10$, $b = 0.5$, and $c = 2$.
Subsituting in 0 for $px_B$ allows us to predict what price firm $A$ would charge if firm $B$'s price was zero.
$$
\begin{aligned}
p_A &= \frac{a(1 - b) + bp_B + c}{2} \\
&= \frac{a(1 - b) + b \cdot 0 + c}{2} \\
&= \frac{a(1 - b) + c}{2} \\
&= \frac{10(1 - 0.5) + 2}{2} \\
&= 3.5
\end{aligned}
$$
This is indeed where the line intersects the axis. The same is true when the firms are flipped.
![](https://res.cloudinary.com/henrydashwood/image/upload/v1697377887/image_20230925113617371_fba36ed188.png)
## (c)
**Suppose Firm $A$ can choose its production quantity first. Firm $B$ sees this choice, then chooses its production quantity. What do you predict would happen?**
This model is known as a Stackelberg competition. Once again the firms are trying to maximise their profits so we'll begin again by noting those profit functions and substituting in the inverse demand functions:
$$
\begin{aligned}
\pi_A &= (p_A - c)x_A \\
&= (a - x_A - bx_B - c)x_A \\
&= a \cdot x_A - {x_A}^2 - bx_B \cdot x_A - c \cdot x_A \\
&= (a - bx_B - c)x_A - {x_A}^2 \\
\\
\pi_B &= (p_B - c)x_B \\
&= (a - x_B - bx_A - c)x_B \\
&= a \cdot x_B - {x_B}^2 - bx_A \cdot x_B - c \cdot x_B \\
&= (a - bx_A - c)x_B - {x_B}^2
\end{aligned}
$$
We first derived the reaction functions when looking at the Cournot competition model. We can do that again to see what firm $B$ will choose after seeing firm $A$'s production choice.
$$
\begin{aligned}
\frac{d\pi_B}{dx_B} &= a - bx_A - c - 2x_B \\
0 &= a - bx_A - c - 2x_B \\
x_B &= \frac{a - bx_A - c}{2}
\end{aligned}
$$
In a Stackelberg model though, firm $A$ anticipates this which means we need to update firm $A$'s profit function. We do this by substituting the reaction function into it.
$$
\pi_A = (a - x_A - b(\frac{a - bx_A - c}{2}) - c)x_A \\
$$
This updated profit function is what we need to differentiate, set to 0, and rearrange to get the reaction function for firm $A$. Again, too much algebra for me to do by hand. However, we can use Sympy.
$$
\begin{aligned}
\frac{d\pi_A}{dx_A} &= - \frac{a b}{2} + a + b^{2} x_{A} + \frac{b c}{2} - c - 2 x_{A} \\
0 &= - \frac{a b}{2} + a + b^{2} x_{A} + \frac{b c}{2} - c - 2 x_{A} \\
x_A &= \frac{\frac{a b}{2} - a - \frac{b c}{2} + c}{b^{2} - 2} \\
&= \frac{a b - 2 a - b c + 2 c}{2 b^{2} - 4} \\
\end{aligned}
$$
The expression for $x_A$ in the textbook is given as $\frac{\left(2 - b\right) \left(a - c\right)}{2(2 - 2 b^{2})}$. We can check that these are equivalent with Sympy:
```python
book_answer = ((2 - b) * (a - c))/(2 * (2 - b**2))
reaction_a.equals(book_answer)
```
This evaluates to True.
We can substitute this into the reaction function for firm $B$ to find firm $B$'s equilibrium quantity.
$$
\begin{aligned}
x_B &= \frac{a - b(\frac{a b - 2 a - b c + 2 c}{2 b^{2} - 4}) - c}{2} \\
&= \frac{- b \left(a b - 2 a - b c + 2 c\right) + 2 \left(a - c\right) \left(b^{2} - 2\right)}{4 \left(b^{2} - 2\right)}
\end{aligned}
$$
Let's visualise this again.
We can plot the iso-profit curves for firm A alongside the reaction curves for the Cournot equilibrium. The iso-profit curve represents all the combinations of outputs (or other variables) that result in a specific level of profit $K$ that firm $A$ aims to achieve. Each point on an iso-profit curve corresponds to the same level of profit. The concept is similar to that of an isoquant in production theory, which represents all the combinations of inputs that result in a specific level of output.
Each iso-curve in this graph is described by the formula
$$
K = x_A(a - x_A - bx_B -c)
$$
We can read it as saying that that e.g. in a scenario where there firm $B$ is producing 8 units, firm A can make a profit of 4 by producing 2 units. Another way of putting this would be to say that if we substituted 2 substitued our constant values $a = 10$, $b = 0.5$, and $c = 2$ into the reaction function for firm $A$ and also substitute $x_B = 8$ we get
$$
\begin{aligned}
x_A(8) &= \frac{10 - 0.5 \cdot 8 - 2}{2} \\
&= 2
\end{aligned}
$$
We can see from the left hand plot that the reaction curve for firm $A$ passes through the peak of firm $A$'s iso-curves.
The right hand plot shows the two reaction functions meeting at a point that in a Cournot model would result in a profit for A of ~10.24. In this scenario both firms have chosen their quantities simulataneously. The Nash equilibrium sees them both produce a quantity of 3.2. Under a Stackelberg model firm $A$ choses its quantity first. Firm $A$ knows that if it produces more than 3.2, firm $B$ will respond by producing less, something which benefits firm $A$.
We can find out how much more profit firm $A$ is able to make under this model by substiting our parameters into the equation for the equilibrium quanty for $x_A$ that we found above. This tells us how much firm $A$ will produce under this model
$$
\begin{aligned}
x_A &= \frac{a b - 2 a - b c + 2 c}{2 b^{2} - 4} \\
x_A &= \frac{10 \cdot 0.5 - 2 \cdot 10 - 0.5 \cdot 2 -4}{2 \cdot 0.5^2 - 4} \\
x_A &\approx ~3.42
\end{aligned}
$$
Substituting this value into the reaction function of firm $B$ tells us how much it will produce
$$
\begin{aligned}
x_B &= \frac{a - bx_A - c}{2} \\
&= \frac{10 - 0.5 \cdot 3.42 - 2}{2} \\
&\approx 3.15
\end{aligned}
$$
Substituting $x_A$ and $x_B$ into the profit function for $A$ gives us
$$
\begin{aligned}
K &= 3.42 \cdot (10 - 3.42 - 0.5 \cdot 3.15 - 2) \\
&\approx 10.29
\end{aligned}
$$
We can see that the iso-curve for $K = 10.29$ is the curve for which the reaction curve for firm $B$ is a tangent. Moving first has allowed firm $A$ to "move along" the curve to a more favourable pair of quantities. It has been able to increase its profit from 10.24 to 10.29.
![](https://res.cloudinary.com/henrydashwood/image/upload/v1697377947/image_20231001154632243_a288e0ad4a.png)
## (d)
**Suppose Firm $A$ can choose its price first. Firm $B$ sees this choice, then chooses its price. What do you predict would happen?**
TODO
]]>
https://www.henrydashwood.com/posts/microeconomics-for-managers-chapter-2
https://www.henrydashwood.com/posts/microeconomics-for-managers-chapter-2Wed, 11 Oct 2023 00:00:00 GMT<![CDATA[Chain rule]]>
https://www.henrydashwood.com/posts/chain-rule
https://www.henrydashwood.com/posts/chain-ruleThu, 27 Apr 2023 00:00:00 GMT<![CDATA[Partial derivatives]]>
https://www.henrydashwood.com/posts/partial-derivatives
https://www.henrydashwood.com/posts/partial-derivativesThu, 27 Apr 2023 00:00:00 GMT<![CDATA[Product rule]]>
https://www.henrydashwood.com/posts/product-rule
https://www.henrydashwood.com/posts/product-ruleThu, 27 Apr 2023 00:00:00 GMT<![CDATA[Quotient rule]]>
https://www.henrydashwood.com/posts/quotient-rule
https://www.henrydashwood.com/posts/quotient-ruleThu, 27 Apr 2023 00:00:00 GMT<![CDATA[Solving second degree equations (deriving the quadratic formula)]]>
https://www.henrydashwood.com/posts/solving-second-degree-equations-deriving-the-quadratic-formula
https://www.henrydashwood.com/posts/solving-second-degree-equations-deriving-the-quadratic-formulaMon, 20 Feb 2023 00:00:00 GMT<![CDATA[Books]]>
https://www.henrydashwood.com/posts/books
https://www.henrydashwood.com/posts/booksSun, 19 Feb 2023 00:00:00 GMT<![CDATA[Programming Cheatsheet]]>` | |
| Stop container with SIGTERM | `docker stop ` | |
| Stop container with SIGKILL | `docker kill ` | |
| Run extra commands inside container | `docker exec -it ` | `-i` makes stuff you type get set to the STDIN and back from the STDOUT and STDERR processes. `-t` makes it get show up on your screen in nicely formatted way |
| Copy file into container | `docker cp ` | |
## tmux
Remember shift key for lots of the characters in these commands
| Action | Command | Notes |
| :--------------------------: | :------------------------------------------------: | :-------------------------------: |
| Install | `sudo apt install tmux` | |
| Create new pane to the right | `Ctrl+b %` | |
| Start | `tmux` | |
| Create new pane below | `Ctrl+b "` | |
| Navigate between panes | `Ctrl+b →` `Ctrl+b ←` `Ctrl+b ↑` `Ctrl+b ↓` | |
| Close current pane | `exit` | |
| Create new window | `Ctrl+b c` | |
| Switch to window by number | `Ctrl+b [WINDOW NUMBER]` | |
| Rename current window | `Ctrl+b ,` + `[NEW NAME]` + `Enter` | |
| Close window | `exit` when there is only one pane left | |
| Detach session | `Ctrl+b d` | |
| List background sessions | `tmux ls` | |
| Attach to session | `tmux attach -t [SESSION NAME]` | |
| Rename session | `tmux rename-session -t [CURRENT NAME] [NEW NAME]` | name is 0, 1, etc by defualt. |
| Create new session | `tmux new -s [SESSION NAME]` | `tmux` names it after next number |
| Delete session | `tmux kill-session -t [SESSION NAME]` | |
| Enter scroll mode in pane | `Ctrl+b [` | `q` to quit mode |
## Unix
Various Linux and/or MacOS things that I find myself forgetting how to do a lot
### Commands
| Action | Command | Notes |
| :-----------------------------------: | :-------------------------------------: | :-------------------------------------------------------------------------: |
| Add a directory to start of your PATH | `export PATH=:$PATH` | |
| Get the size of of a directory | `du -sh ` | [See more](https://linuxize.com/post/how-get-size-of-file-directory-linux/) |
| Change the ownership of a directory | `sudo chown -R ` | |
| Add new user | `adduser ` | |
| Delete a user | `sudo deluser --remove-home ` | |
| Add higher privileges | `usermod -aG sudo ` | |
## Excel
| Action | Mac | Windows | Notes |
| :--------------: | :---------: | :---------: | :--------------------------------------------------------------------------------------------------------: |
| Go to first cell | `Ctrl+home` | `Ctrl+home` | On a MacOS laptop this means `Ctrl+fn+left arrow`. On a desktop keyboard there are home up and down arrows |
## Visual Studio Code
| Shortcut | Description |
| :-------------: | :--------------------------------------------------: |
| shift+alt+arrow | Duplicate the line the cursor is on |
| cmd+alt+arrow | New cursor on line below or above current cursor |
| cmd+shift+L | Cursors on every occurance of highlighted text |
| cmd+g | Move cursor to next occurance of highlighted text |
| cmd+d | Highlight next occurance of highlighted text as well |
| ctrl+\` | Open integrated terminal pane |
## Python
### F Strings
| Input | Output |
| :-------------------- | :---------------------------------- |
| `f"{'text':10}"` | "text\\\\\\\\\\" (\ = whitespace) |
| `f"{"test":#>10}"` | "######test" |
| `f"{"test":#<10}"` | "test######" |
| `f"{"test":#^10}"` | "###test###" |
| `f"{12345:0>10}"` | "0000012345" |
| `f"{-12345:0=10}"` | "-000012345" |
| `f"{12345:010}"` | "0000012345" |
| `f"{-12345:010}"` | "-000012345" |
| `f"{math.pi:.2f}"` | "3.14" |
| `f"{1000000:,.2f}"` | "1,000,000.00" |
| `f"{1000000:\_.2f}"` | "1_000_000.00" |
| `f"{12345:+}"` | "+12345" |
| `f"{-12345:+}"` | "-12345" |
| `f"{-12345:+10}"` | "\\\\\\\\\\-12345" (\ = whitespace) |
| `f"{-12345:+010}"` | "-000012345" |
| `f"{10:b}"` | "1010" |
| `f"{10:o}"` | "12" |
| `f"{200:x}"` | "c8" |
| `f"{200:X}"` | "C8" |
| `f"{345600000000:e}"` | "3.456000e+11" |
| `f"{65:c}"` | "A" (ASCII value) |
| `f"{10:#b}"` | "0b1010" |
| `f"{10:#o}"` | "0o12" |
| `f"{10:#x}"` | "0xa" |
| `f"{0.25:0%}"` | "25.000000%" |
| `f"{0.25:.0%}"` | "25%" |
]]>
https://www.henrydashwood.com/posts/programming-cheatsheet
https://www.henrydashwood.com/posts/programming-cheatsheetFri, 17 Feb 2023 00:00:00 GMT<![CDATA[Bioinformatics]]>` or less commonly a `;`. Below is the first 5 lines of an example FASTA file.
```text
>NM_002299.4 Homo sapiens lactase (LCT), mRNA
GAAAATGGAGCTGTCTTGGCATGTAGTCTTTATTGCCCTGCTAAGTTTTTCATGCTGGGG
GTCAGACTGGGAGTCTGATAGAAATTTCATTTCCACCGCTGGTCCTCTAACCAATGACTT
GCTGCACAACCTGAGTGGTCTCCTGGGAGACCAGAGTTCTAACTTTGTAGCAGGGGACAA
AGACATGTATGTTTGTCACCAGCCACTGCCCACTTTCCTGCCAGAATACTTCAGCAGTCT
```
### FASTQ
An extension of FASTA. Used in Next Generation Sequencing. It generally produces bigger files which can create headaches when transferring data.
### Binary Alignment Map (BAM)
After receiving data from the sequencer, you will normally use a tool such as Burrows-Wheeler Aligner (BWA) to align your sequences to a reference genome. Most users will have a reference genome for their species.
The most common representation for aligned data is the sequence alignment map (SAM) format. The compressed version of SAM is BAM. Indexable for extremely fast random access e.g. to find alignments to a certain part of a chromosome. You need an index for your BAM file which is normally created by the tabix utility of SAMtools, the most widely used tool for manipulating SAM/BAM files.
### Variant Call Format (VCF)
## Databases
- National Center for Biotechnology Information (NCBI)
- - GenBank
- - Nucleotide Database
- - PubMed
## Metrics
### Phred quality score
Logarithmic representation of the probability of an accurate call. This probability is given as $$10^{-Q/10}$$. So a Q of 10 represents a 90% call accuracy, 20 represents 99% call accuracy, and 30 will be 99.9%. For our file, the maximum accuracy will be 99.99% (40). In some cases, values of 60 are possible (99.9999% accuracy).
## Algorithms
### Reverse Complement
Gets the bases from the opposite strand of DNA
```python
def reverseComplement(s):
complement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A', 'N': 'N'}
t = ''
for base in s:
t = complement[base] + t
return t
```
### Naive Sequence Matching
A slow but simple way of solving the read alignment problem
```python
def naive(p, t):
occurrences = []
for i in range(len(t) - len(p) + 1): # loop over alignments
match = True
for j in range(len(p)): # loop over characters
if t[i+j] != p[j]: # compare characters
match = False
break
if match:
occurrences.append(i) # all chars matched; record
return occurrences
```
### Boyer Moore Matching
## Tools
- [Biopython](https://biopython.org)
- FastQC
- [MultiC](https://multiqc.info/)
- SAMTools
- [Trimmomatic](http://www.usadellab.org/cms/?page=trimmomatic)
- [Trimmomatic manual](http://www.usadellab.org/cms/uploads/supplementary/Trimmomatic/TrimmomaticManual_V0.32.pdf)
- [STAR](https://github.com/alexdobin/STAR)
- [HTSeq](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4287950/)
- FastP
- [Pysam](https://github.com/pysam-developers/pysam)
- Kraken2
## Epigenetics
Illumina make the most popular machines for reading DNA methylation.
## Further Resources
### Youtube
[Alex Soupir](https://www.youtube.com/user/alexsoupir/about)
[Simon Cockell](https://www.youtube.com/c/SimonCockell/about)
### Books
### Courses
]]>
https://www.henrydashwood.com/posts/bioinformatics
https://www.henrydashwood.com/posts/bioinformaticsThu, 16 Feb 2023 00:00:00 GMT<![CDATA[Publications]]>
https://www.henrydashwood.com/posts/publications
https://www.henrydashwood.com/posts/publicationsWed, 15 Feb 2023 00:00:00 GMT<![CDATA[Weltanschauung]]>
https://www.henrydashwood.com/posts/weltanschauung
https://www.henrydashwood.com/posts/weltanschauungTue, 14 Feb 2023 00:00:00 GMT<![CDATA[On Beowulf]]>
https://www.henrydashwood.com/posts/on-beowulf
https://www.henrydashwood.com/posts/on-beowulfFri, 23 Apr 2021 00:00:00 GMT<![CDATA[On Zero]]>
https://www.henrydashwood.com/posts/on-zero
https://www.henrydashwood.com/posts/on-zeroFri, 11 Sep 2020 00:00:00 GMT