1843 stories
·
2 followers

Higher derivatives of an inverse function

1 Share

I learned something beautiful today and just wanted to share it. Obviously, this blog is super eclectic, with tons of posts on science and math and art and life, with no particular order. Maybe someday I’ll organize it.

This a pretty basic calculus trick. In fact, I wouldn’t be surprised if I’d come across it in high school and just forgot it. But today it came up in my research, and I had to rederive it, and I thought it was very pretty.

So say you have a scalar function $s(t)$, which we’ll assume to be differentiable and generally cooperative. You can go ahead and find its derivatives $\frac{d s}{d t}, \frac{d^2 s}{d t^2}, \frac{d^3 s}{d t^3}$, and so on. But suppose that (like I did) for some problem at hand, you need the derivatives in the other direction: $\frac{d t}{d s}, \frac{d^2 t}{d s^2}, \frac{d^3 t}{d s^3}$ and so on.

(It’s worth noting that the inverse function $t(s)$ doesn’t actually have to exist globally for this to work — that is, $s(t)$ need not be one-to-one. It just needs to be one-to-one locally, so you can define $t(s)$ in a local region, and take derivatives, after which you can forget about $t(s)$. This amounts to requiring that $\frac{d s}{d t} \neq 0$ at the point of study, and indeed our final formulae will diverge if $\frac{d s}{d t} = 0$, indicating this requirement.)

The first derivative. Delightfully, it holds that

$$ \frac{ d t}{ds} = \left( \frac{ds}{dt} \right)^{-1}, $$

as you can easily confirm by drawing a scalar function and transposing the two axes. I find this result really great because you can just treat $\frac{ds}{dt}$ as a conventional fraction and take its inverse. Shows it’s great notation.

The second derivative. This one we need to be more careful about. Our main tool is the chain rule: $\frac{d}{ds} = \frac{dt}{ds} \cdot \frac{d}{dt}$. Applying this, we find that $\frac{d^2 t}{ds^2} = \frac{d}{ds} \frac{d t}{d s} = \frac{d t}{d s} \cdot \frac{d}{dt} \frac{d t}{d s} = \left( \frac{d s}{d t} \right)^{-1} \cdot \frac{d}{d t} \left( \frac{d s}{d t} \right)^{-1}$, and evaluating the final derivative we find that

$$ \frac{d^2 t}{ds^2} = - \left( \frac{d s}{d t} \right)^{-3} \frac{d^2 s}{d t^2}. $$

I find this really nice — the second derivatives are proportional, with the rather surprising constant of proportionality of $- \left( \frac{d s}{d t} \right)^{-3}$. Even though it didn’t solve the particular research problem I hoped it would, seems like it might eventually be useful for something. (Wonder if there’s some intuition for that other than a dimensionality argument…)

The third derivative. Again applying the chain rule, taking $\frac{d^3 t}{ds^3} = \frac{dt}{ds} \cdot \frac{d}{dt} \frac{d^2 s}{dt^2}$, we find that

$$ \frac{d^3 t}{ds^3} = - \left( \frac{d s}{d t} \right)^{-5} \left[3\left(\frac{d^2 s}{d t^2}\right)^2 - \frac{d s}{d t} \cdot \frac{d^3 s}{dt^3}\right]. $$

Not as pretty, and you lose the nice constant of proportionality between $s^{(k)}(t)$ and $t^{(k)}(s)$. Thanks to the chain rule, things only get more complicated from here on out.

Read the whole story
mrmarchant
1 hour ago
reply
Share this story
Delete

Key, in sight

1 Share
A guide, of sorts, to keyboard customization. (9,400 words.)
Read the whole story
mrmarchant
1 hour ago
reply
Share this story
Delete

Fontificator

1 Share

I thought about this the other day, and I thought it’d be fun to share this internal tool I made over a decade ago to aid with exploring options for Medium’s typographical redesign.

It’s called Fontificator. You can play with Fontificator here (desktop browsers only), or watch the likely confusing video below:

The motivation for building Fontificator came from two observations:

  • font previews on type foundry sites were generally too limited to get a real sense of how a certain typeface feels, and it was best to see a font in situ,
  • often an extremely tiny nuance – like adding some letter spacing, or messing with line height – was what separated something that was promising from something that seemed very far from working.

With Fontificator, I was aiming at this Doug Engelbart-esque notion of one hand on the keyboard + one hand on the mouse, and the UI where it was only necessary to point to an element, and the keys under your other hand would start working immediately – no clicking needed:

  • F and G to change the font,
  • – and + for font size,
  • ← and → for letter spacing,
  • ↑ and ↓ for line height,
  • < and > for opacity (for all the above you can hold Shift for bigger moves),
  • and, there are a few more shortcuts you can see at the top.

This way, we could move really, really fast. To accommodate that, Fontificator always tried to keep the current item under the cursor by counter-adjusting scroll position as needed.

On top of it all, a few more shortcuts:

  • ⇥ and ⇧⇥ move very quickly between different types of stories so you can preview that,
  • Space compares to the original/​current version,
  • 1–9 allow you to switch to different “slots” so you can have various presets ready to compare,
  • Esc hides the toolbar for maximum immersion,
  • ⇧R resets.

You can also edit any text if you are so inclined, and also drag in any font file from your computer onto a paragraph – then that font becomes part of the F/G stack. (Bernino Sans and Freight Text were the starting fonts before the redesign.) On the left, you can also see a naïve mobile preview – there was also more sophisticated on-smartphone preview, but I removed it from this restored version.

Fontificator was literally made for an audience of 2–3 designers (and perhaps 1–2 stakeholders in read-only mode), and it was surprising to me how quickly one could master this strange tool, have fun with it, and feel the entire typography on the page becoming much more malleable. We also put up a more “traditional” list of contenders on the wall…

…but it was in Fontificator where we learned the most.

I love internal UIs because they allow you to go very wild and very tactical. If you have one you’d be willing to share (maybe it, too, is on the other side of the statute of limitations?), or one you already wrote about or spotted someone else doing so, please let me know!

#internal ui #typography

Read the whole story
mrmarchant
3 hours ago
reply
Share this story
Delete

A blocked GMO rice could have saved 100,000 children. The same tech makes pineapples pink.

1 Share

Every year, vitamin A deficiency blinds 250,000 to 500,000 children. Half of them die within a year of losing their sight.

One third of children worldwide are deficient, roughly half of children in sub-Saharan Africa and Southeast Asia1. Deficiency weakens the immune system, so children are more likely to die from common infections like diarrhea or measles.

Rich countries solved this kind of problem by adding nutrients to staple foods. The United States adds iodine to most salt, and folic acid to flour to prevent birth defects.

Rice is a critical staple among the world’s poor, so scientists improved rice. They added beta-carotene, the thing that makes carrots orange and that the body turns into vitamin A. The new rice cooks and tastes the same, but it’s yellow. They called it Golden Rice and licensed it for free to any farmer earning under $10,000 a year.

It has been ready since the mid-2000s. Today it grows nowhere.

The reason is that it is a GMO. Environmental groups, led by Greenpeace, fought it in country after country for two decades.

As far as I can tell, no one has calculated the cost of that delay. I’ve spent the last few weeks doing so. My rough estimate is that the delay has killed about 110,000 children and left another 220,000 to 440,000 blind.2 Measured in healthy years of life lost, that is somewhere between 8 and 12 million.3 (My full calculations are here. I will update these figures as I receive more feedback.)

That works out to roughly fifteen children dying every single day, for twenty years, from a nutrient we already know how to add to food.

If a new disease were killing fifteen children a day, it would have an internationally-recognized name and a task force. Golden Rice got villified as one word instead: GMO.

“GMO”

Often, that word scares people. But we eat GMOs all the time. They are in about 70 percent of packaged American food, 96 percent of US soybeans, and 92 percent of US corn. Billions of people have eaten them every day for thirty years. No one has been harmed.

Golden Rice was different in one small way. Most GMO crops are changed in how they grow, so the part you eat is ordinary. In Golden Rice, the part you eat is the part that changed. That made it feel new.

Greenpeace framed it as dangerous, saying corporations were secretly behind it. They falsely claimed it was unproven and that it was unclear whether children could absorb the vitamin. Activists tore up test fields and filed lawsuits to block approval. Over a hundred Nobel laureates signed a letter asking Greenpeace to stop.

While Golden Rice sat blocked, other new GMO foods reached store shelves. One of them is a pink pineapple. It sells for about $10 in stores and up to $50 online. It uses the same chemistry as Golden Rice, run in the opposite direction. Golden Rice turns on the pathway that makes the vitamin children need. The pineapple turns it off, so the fruit stays a pretty pink.

The lifesaving technology is in the Western world, growing a nicer pineapple for parties.

Source: Del Monte’s East Coast vendor TropicalFruitBox.com

I’m grateful for this pineapple. The pineapple has a company behind it that can afford to fight critics and build a market around modified foods. Golden Rice only had scientists and charities. It was a cheap crop for poor people, with no profit margin to help it defend itself.

In 2021, the Philippines became the first country to approve Golden Rice. Three years later, a court there revoked the approval after Greenpeace and a group of farmers sued.

Blocking a new crop is cheap. A single lawsuit claiming there is no scientific consensus on its safety can freeze it for years, even when consensus exists. Approving it is expensive because a government must be willing to spend political capital on people who cannot pay it back. Golden Rice’s beneficiaries were poor, scattered, and far from anyone in charge.

When one of these children dies, the cause is recorded as measles, diarrhea, or poverty, never as the campaign that kept the cure out of the field. A plane crash kills a few hundred people and leads to grounding fleets immediately. This killed more than a hundred thousand children over twenty years, with no wreckage to photograph and no single day it happened on.

That may be starting to change: the Global South is engineering crops of its own now, aimed at preventing harm, like pests and crop failure, rather than high margins or novelty. One is a cassava richer in iron and zinc. The more of these that become normal, the harder it gets to keep blocking the one that should have come first.

Subscribe now

Share

This post took several weeks of research and calculation. If you found it useful, please consider becoming a paid subscriber.

1

As of 2013 WHO data.

2

I estimated this by adding up the countries with high vitamin A deficiency and high rice consumption, then projecting how long it would take Golden Rice to reach about 70 percent adoption.

3

The closest estimate I found was a 2014 peer-reviewed study finding that India lost 1.4 million healthy years in a single decade.

Read the whole story
mrmarchant
6 hours ago
reply
Share this story
Delete

AI Economics for Dummies

1 Share

As AI companies get ready to go public and we get a deeper look at their inner workings, it’s only natural to have questions about their finances, like “Do they make money?” and “How?” Here are a few examples to help the average layperson understand the business side of AI.

1. Acquiring one grape costs Alex $2 billion. Alex offers to sell Mike one grape a month for the next 12 months for $1 billion per grape. Alex asks for the full $12 billion up front and provides Mike with one grape for the first month. Alex makes a $10 billion profit this month; his ARR is $120 billion, and his profits are trending up at an infinite rate. The Wall Street Journal’s business editor moves into Alex’s house, having accepted a part-time position as Alex’s human footstool. He never asks to see the books.

2. Laura drives a taxi. Instead of charging her customers a fee for every ride, she charges them a $20/month subscription. Laura has 40 million paying customers, totaling roughly $13 billion in annual revenue. Laura spends $25 billion/year on gas. In a fit of late-capitalist bloodlust, hordes of tech and finance bros riot in the streets, firebombing every rideshare, bus, and pedicab they can find, declaring the transportation business officially “over.” Also, Laura’s taxi cost her $1 trillion to attain, and she’ll have to replace it in four to eight years.

3. Jenny owns a crematorium. John’s propane company gives her a $20 billion investment in return for 5 percent of her operation. Jenny throws $10 billion into the incinerator, then pays John $10 billion to buy propane to burn that money to ashes. John reports that his AI investments have generated $10 billion in revenue this quarter and that he owns 5 percent of a $100 billion business. A reporter from Forbes is assigned to profile John and Jenny, and over the course of his research, he becomes embroiled in a passionate but confusing three-way love affair with them, which eventually turns into a polyamorous common-law marriage. His profile is glowing, but light on financial details.

4. Benjamin owns a farm. He employs 100 workers plowing his fields. His total payroll is $10 million/year. One day, he buys a mule, which provides the worker who uses it with a modest 10 percent productivity gain. Benjamin fires 99 of his workers and purchases 99 mules, expecting a 1,000 percent productivity gain. The driverless mules cause plow damage to his property in excess of $50 million. Benjamin loses another $5 million due to the loss of productivity from his one remaining employee, who no longer guides a plow but instead spends 100 percent of his time shoveling mule shit. Goldman Sachs builds an altar to Benjamin in their lobby and cuts out the heart of a junior analyst on it every Friday. They call it “Blood Sacrifice Friday.” The name isn’t catchy, but the event becomes a management favorite nonetheless.

5. Xavier owns an apartment that he rents out at a loss of $1 billion/month. Seeing this success, he decides to make financial commitments to construct $850 billion in new apartments in places nobody wants them. He convinces Ted to leverage everything he owns to help him build the apartments, telling him that once they are built, every human being on Earth will live in them. Ted contributes $100 billion, part of which immediately goes toward paying off Xavier’s $1 billion/month loss. Forbes gives Xavier and Ted a cover feature, likening their building project to God creating the Heavens and the Earth. Many Fortune 500 CEOs take this comparison literally and establish a new religion around Ted and Xavier, with themselves as high priests. Soon, they start a Holy War with the pope, declaring “Ted and Xavier the One True Gods on Earth” and promising to “purge the nonbelievers” in an official press release. They annex, then subsequently demolish, Vatican City, committing another $900 billion dollars to build new apartments in its place. Forbes hails this as “disruptive,” though it’s not clear how Ted and Xavier plan to finance the project.

We hope these examples help clarify the inner workings of AI economics. But if you’re still confused, all you really need to know is that everything is totally working and everyone is making a lot of money, and you should just stop asking questions, luddite.

Read the whole story
mrmarchant
4 days ago
reply
Share this story
Delete

If You are Asking for Human Attention, Demonstrate Human Effort

2 Shares

An ever-increasing volume of debug investigations, document writing, and code is written by robots. This has created a new etiquette question when working with a team - when is it OK to forward the output of an AI to another human to read?

On one hand, an AI with robust integration to internal code bases and documentation often produces genuinely1 useful output.

On the other, as an increasing amount of a software engineer's day is spent reading AI text, a fatigue sets in. If I can have a robot say something, so can you. It reads as inconsiderate to post un-digested AI output as though it's your own writing.

I remember the first time I experienced this annoyance. I proposed a design, and a teammate prompted an AI to critique it. The teammate sent an AI document to me, with the disclaimer: "I didn't read this, so it might not be entirely accurate". My thought was, _if reading this wasn't worth your time, why is it worth mine?"

Therefore, I've adopted this principle in my work:

If you are requesting human attention, demonstrate human effort.

If useful, I send AI generated content to teammates. But when doing so, I take care to clearly label what is AI generated, and I add my own commentary alongside it. For human code review requests, I always review my AI-generated code first.

Attention was already a scarce resource before AI, and it is even more so now. Keeping AI generated content clearly labeled and demonstrating human effort helps show consideration for teammates, and keeps a touch of humanity alive in our work.

Footnotes

  1. I promise I wrote this (and all the words in this post) with my meat fingers!

Read the whole story
mrmarchant
4 days ago
reply
Share this story
Delete
Next Page of Stories