Posts tagged with **functions**

Monotone and antitone functions

(not over ℝ just the domain you see = `0<x<1⊂ℝ`

)

These are examples of invertible functions.

(Source: talizmatik)

hi-res

Three different ways of looking at a 𝔸²→𝔸¹ function:

- colour the plane
- number the plane
- heights in a 3-D view

Is this a simple or complex function? It has lots of discontinuities; it doesn’t correspond in any obvious way to any classical mathematical functions; to program it would surely take a lot of “arbitrary”, non-simple specifications. And yet it’s easily recognisable to any of us.

image by Gonzalez & Woods

(Source: class.coursera.org)

hi-res

What does it mean to program in a functional style? (por Brian Will)

- functions can be passed—as arguments—to other functions
`if`

,`try`

,`while`

return something- adhere to statelessness (no side effects, so you can see everything that a function does just looking in the one place)

The λ-calculus is, at heart, a simple notation for functions and application. The main ideas are applying a function to an argument and forming functions by abstraction. The syntax of basic λ-calculus is quite sparse, making it an elegant, focused notation for representing functions. Functions and arguments are on a par with one another. The result is an intensional theory of functions as rules of computation, contrasting with the traditional extensional approach one of function as a set of pairs of a certain kind. Despite its sparse syntax, the expressiveness and flexibility of the λ-calculus make it a cornucopia of logic and mathematics. This entry develops some of the central highlights of the field and prepares the reader for further study of the subject and its applications in philosophy, linguistics, computer science, and logic.

Alama, Jesse, “The Lambda Calculus”, *The Stanford Encyclopedia of Philosophy* (Spring 2013 Edition), Edward N. Zalta (ed.),

via David A Edwards

**going the long way**

*What does it mean when mathematicians talk about a bijection or homomorphism?*

Imagine you want to get from `X`

to `X′`

but you don’t know how. Then you find a "different way of looking at the same thing" using ƒ. (Map the stuff with ƒ to another space `Y`

, then do something else over in `image ƒ`

, then take a journey over there, and then return back with ƒ ⁻¹.)

The fact that a bijection can show you something in a new way that suddenly makes the answer to the question so obvious, is the basis of the jokes on www.theproofistrivial.com.

In a given category the homomorphisms `Hom`

∋ ƒ preserve all the interesting properties. Linear maps, for example (except when `det=0`

) barely change anything—like if your government suddenly added another zero to the end of all currency denominations, just a rescaling—so they preserve most interesting properties and therefore any linear mapping to another domain could be inverted back so anything you discover over in the new domain (`image of ƒ`

) can be used on the original problem.

All of these fancy-sounding maps are linear:

- Fourier transform
- Laplace transform
- taking the derivative
- Box-Müller

They sound fancy because whilst they leave things technically equivalent in an objective sense, the result looks very different to people. So then we get to use intuition or insight that only works in say the spectral domain, and still technically be working on the same original problem.

Pipe the problem somewhere else, look at it from another angle, solve it there, unpipe your answer back to the original viewpoint/space.

For example: the Gaussian (normal) cumulative distribution function is monotone, hence injective (one-to-one), hence invertible.

By contrast the Gaussian probability distribution function (the “default” way of looking at a “normal Bell Curve”) fails the horizontal line test, hence is many-to-one, hence cannot be totally inverted.

So in this case, integrating once `∫[pdf] = cdf`

made the function “mathematically nicer” without changing its interesting qualities or altering its inherent nature.

Or here’s an example from calc 101: **u-substitution**. You’re essentially saying “Instead of solving this integral, how about if I solve a different one which is exactly equivalent?” The `→ƒ`

in the top diagram is the u-substitution itself. The “main verb” is doing the integral. U-substituters avoid doing the hard integral, go the long way, and end up doing something much easier.

Or in physics—like tensors and Schrödinger solving and stuff.

Physicists look for substitutions that make the computation they *have* to do more tractable. Try solving a Schrödinger PDE for hydrogen’s first electron `s¹`

in `xyz`

coordinates (square grid)—then try solving it in spherical coordinates (longitude & latitude on expanding shells). Since the natural symmetry of the `s¹`

orbital is spherical, changing basis to polar coords makes life much easier.

Likewise one of the goals of tensor analysis is to not be tied to any particular basis—so long as the basis doesn’t trip over itself, you should be free to switch between bases to get different jobs done. Terry Tao talks about something like this under the keyword “spending symmetry”—if you use up your basis isomorphism, you need to give it back before you can use it again.

"Going the long way" can be easier than trying to solve a problem directly.

Saying derivative is “slope” is a nice pedant’s lie, like the Bohr atom

which misses out on a deeper and more interesting later viewpoint:

The “slope” viewpoint—and what underlies it: the “charts” or “plots” view of functions as `ƒ(x)–vs–x`

—like training wheels, eventually need to come off. The “slope” metaphor fails

- for pushforwards,
- on surfaces,

- on curves γ that double back on themselves

- my vignettes about integrals,
- and, in my opinion, it’s harder to “see” derivatives or calculus in a statistical or business application, if you think of “derivative = slope”. Since you’re presented with reams of numbers rather than pictures of
`ƒ(x)–vs–x`

, where is the “slope” there?

"Really" it’s all about **diff’s**. Derivatives are differences (just zoomed in…this is what `lim ∆x↓0`

was for) and *that* viewpoint works, I think, everywhere.

I half-heartedly tried making the following illustrations in R with the barcode package but they came out ugly. Even uglier than my handwriting—so now enjoy the treat of my ugly handwriting.

Step back to **Descartes’** definition of a function. It’s an **association between two sets.**

And the language we use sounds “backwards” to that of English. If I say “associate a temperature number *to* every point over the USA”

then that should be written as a function `ƒ: surface → temp`

.,

(or we could say `ƒ: ℝ²→ℝ`

with `ℝ²=(lat,long)`

)

The `\to`

arrow and the *"maps to"* phrasing are backwards of the way we speak.

- "Assign a temperature to the surface" —versus— "Map each surface point to a temperature element from the set of possible temperatures”.

`{elf, book, Kraken, 4^π^e}`

… no, I’m not sure where that came from either. But I think we can agree that such a set is unstructured.

Great. I drew above a set “without other structure" as the source (domain) and a branched, partially ordered weirdy thing as the target (codomain). Now it’s possible with some work to come up with a calculus like the infinitesimal one on ℝ→ℝ functions that’s taught to many 19-year-olds, but that takes more work. But for right now my point is to make that look ridiculous and impossible. Newton’s calculus is something we do only with a specific kind of Cartesian mapping: where both the `from`

and the `to`

have Euclidean concepts of straight-line-ness and distance has the usual meaning from maths class. In other words the Newtonian derivative applies only to smooth mappings from ℝ to ℝ.

Let’s stop there and think about **examples of mappings.**

(Not from the real world—I’ll do another post on examples of functions from the real world. For now just accept that numbers describe the world and let’s consider abstractly some mappings that associate, not arbitrarily but in a describable pattern, some numbers to other numbers.)

(I didn’t have a calculator at the time but the circle values for `[1,2,3,4,5,6,7]`

are `[57°,114°,172°,229°,286°,344°,401°=41°]`

.)

I want to contrast the “map upwards” pictures to both the Cartesian pictures for structure-less sets

and to the normal graphical picture of a “chart” or “plot”.

Notice what’s obscured and what’s emphasised in each of the picture types. The plots certainly *look* better—but we lose the Cartesian sense that the “vertical” axis is no more vertical than is the horizontal. Both ℝ’s in ƒ: ℝ→ℝ are just the same as the other.

And if I want to compose mappings? As in the parabola picture above (first the `square`

function, then an affine recentering). I can only show the end result of g∘ƒ rather than the intermediate result.

Whereas I could line up a long vertical of successive transformations (like one might do in Excel except that would be column-wise to the right) and see the results of each “input-output program”.

(Además, I have a languishing draft post called “How I Got to Gobbledegook” which shows how much simpler a sequence of transforms can be rather than “a forbidding formula from a textbook”.)

Another weakness of the “charts” approach is that whereas `"Stay the same"`

command ought to be the simplest one (it’s a null command), it gets mapped to the 45˚ line:

Here’s the familiar parabola / `x²`

plot “my way”: with the numbers written out so as to equalise the target space and the source space.

Now the “new” tool is in hand let’s go back to the calculus. Now I’m going to say **"derivative=pulse"** and that’s the main point of this essay.

Considering both the source ℝ→ and the target →ℝ on the same footing, I’ll call the length of the arrows the “mapping strength”. In a convex mapping like `square`

the diffs are going to increase as you go to the right.

OK now in the middle of the piece, here is the main point I want to make about derivatives and calculus and how looking at *numbers* written on the paper rather than *plots* makes understanding a push forward possible. And, in my opinion, since in business the gigantic databases of numbers are commoner than charts making themselves, and in life we just experience stimuli rather than someone making a chart to explain it to us, this perspective is the more practical one.

I’m deliberately alliding the concepts of diff as

- difference
`R`

's`diff`

function- differential (as in differential calculus or as in linear approximation)

**Linear**

I’m still not quite done with the “my style of pictures” because there’s another insight you can get from writing these mappings as a bar code rather than as a “chart”. Indeed, this is exactly what a rug plot does when it shows histograms.

Here are some strip plots = rug plots = carpet plots = barcode plots of nonlinear functions for comparison.

The main conclusion of calculus is that nonlinear functions can be approximated by linear functions. The approximation only works “locally” at small scales, but still if you’re engineering the screws holding a plane together, it’s nice to know that you can just use a multiple (linear function) rather than some complicated nonlineary thingie to estimate how much the screws are going to shake and come loose.

For me, at least, way too many years of solving `y=mx+b`

obscured the fact that *linear functions are just multiples*. You take the space and stretch or shrink it by a constant multiple. Like converting a currency: take pesos, divide by 8, get dollars. The multiple doesn’t change if you have 10,000 pesos or 10,000,000 pesos, it’s still the same conversion rate.

So in a neighborhood or locality a linear approximation is enough. That means that a collection of linear functions can approximate a nonlinear one to arbitrary precision.

That means we can use computers!

**Square**

I can’t use the example of `self times self`

so many times without exploring the concept a bit. Squares to me seem so limited and boring. No squizzles, no funky shapes, just boring chalkboard and rulers.

But that’s probably too judgmental.

After all there’s something self-referential and almost recursive about repeated applications of the `square`

function. And it serves as the basis for Euclidean distance (and standard deviation formula) via the Pythagorean theorem.

How those two are connected is a mystery I still haven’t wrapped my head around. But a cool connection I have come to understand is that between:

- a variety of inverse square laws in Nature
- a curve that is equidistant from a point and a line
- and the area of a rectangle which has both sides equal.

I guess first of all one has to appreciate that “parabola” shouldn’t necessarily have anything to do with `x•x`

. Hopefully that’s become more obvious if you read the sections above where I point out that the target ℝ isn’t any more “vertical” than is the source ℝ.

The inverse-square laws show up everywhere *because our universe is 3-dimensional*. The surface of a 3-dimensional ball (like an expanding wave of gravitons, or an expanding wave of photons, or an expanding wave of sound waves) is 2-dimensional, which means that whatever “force” or “energy” is “painted on” the surface, will drop off as the square rate (surface area) when the radius increases at a constant rate. Oh. Thanks, Universe, for being 3-dimensional.

What’s most amazing about the parabola—gravity connection is that it’s a metaphor that spans across both space *and* time. The curvature that looks like a-plane-figure-equidistant-to-a-line-and-a-point is curving *in time*.

In game theory the word “strategy” means a fully specified **contingency plan**. Whatever happens—be it a sequence of things, a conditional branching of their responses and my responses—∃ a contingency.

I can’t prove this, but I do feel that sometimes people talk about others as constants rather than response functions.

(A function is a ≥1-to-1 association from elements of a source domain to elements of a target codomain. I’ll owe ya a post on how this is not the most intuitive way to think about functions. Because it depends which domains you’re mapping from and to. Think for example about automorphisms—turning something over in your hand—versus measures—assigning a size to something.)

For example, extraversion vs introversion. This is one of the less disputatious dimensions of human variation from the MBTI. We can observe that some people (like me) gain more energy by being around people and feel like sh*te when they spend too much time alone, whereas others (like my best friend) replenish their reserves by being alone and drain them when they go out in public.

So we observe one datum about you—but sometimes a discussion (eg, an economics debate) wants to veer over counterfactual terrain—in which case we need a theory about how things *might else have been*.

- Maybe when you were young, your parents always made you do chores whenever they saw you, but didn’t particularly seek you out when you were out of sight. So you learned to hide in your room, avoid chores, and develop your personal life there. Hence
*became*introverted**as a response to**environmental factors. - When I was young, I used to think I was introverted. Really I was just widely disliked and unpopular for being an ugly nerd. But later in life I developed social skills and had the fortune to meet people I liked, who liked me back.
**In response to**who was around, I*became*extraverted.

I can think of other aspects of myself that are obviously *responses to* situational stimuli rather than innate constants.

- If I were raised in a different culture, my sexuality would be different. In my culture, homosexuality is seen as “You boink / date / marry from your own sex”, but in ancient Sparta women all gayed on each other as a matter of ritual before the men came home from war. But they didn’t call themselves homos, and neither did the Roman men who sexually touched each other. It was just a different conception of sex (one I can’t fathom) where “Just because I regularly crave and do sexual stuff with people of my own sex, doesn’t mean I’m gay!”

Point being this is all the result of inputs; born Puritan, think sex = evil. Born Roman, "sexuality is a behaviour, not an identity". - If I ate more food and exercised less, my fat:muscle ratio would increase.

- If I meditated more, I would feel more at peace.
- If I read more maths, I would know more maths. More people would think of me as a mathematician—but not because it was inevitable or inherent in me to be a mathmo, rather because I chose to do maths and became the product of my habits.
- If I fixed more bikes, I would be able to fix bikes faster.
- If I made more money, I would go to different places, meet different people, be exposed to their response functions to their own pasts and presents and anxieties and perceptions, a vector field of non-Markovian baggage, and all of this history and now-ness would sum up to some stimuli-complex that would cause some response by me, and change me in ways I can’t now know.

- Our friendship
*could have*been so much more, but we sort of let it fall off. Not for any reason, but it’s not so strong now. - Our love
*could have been*so much less volatile, but I slept around, which had repercussions for your feelings toward me, which repercussed to my feelings toward you, which repercussed …. (multiplier effect / geometric series)

Besides being motivation for me to learn more maths to see what comes out of this way of thinking about people when you layer abstract algebra over it, this view of people is a reminder to

- release the egotism, and
- not take too literally what I think I’m seeing of whomever I’m interacting with.

Someone who piss me off may not be “a jerk”, it may not be about me whatever, s/he may be lag-responding to something from before I was there. Or s/he may not have adapted to a “nice guy” equilibrium of interacting with me. Who knows. I’m not seeing *all* of that person’s possibility, just a particular response to a particular situation.

On the other hand, if they really are acting wrong, it’s up to me to address the issue reasonably right away, rather than let my frustration passive-aggressively fester. Wait ten years for revenge and they’ll be a different person by then.

The final suggestion of people-as-functions is that there’s always something buried, something untapped—like part of a wavefunction that will never be measured, or a button on a machine that never gets pressed. You may see one version of yourself or someone else, but there’s more latent in you and in them—if you’re thrown into a war, a divorce, the Jazz Age, the Everglades, a hospice, a black-tie dinner, poverty, wealth, a band, a reality show about life under cruel premodern conditions—that may bring out another part of them.

**UPDATE:** peacemaker points out the similarity between people-as-response functions and the nature/nurture debate. I think this viewpoint subsumes both the nature and the nurture side, as well as free will.

- Evolution shaped our genes in response to environmental pressures (see for example the flies’ eyes chart above).
- My assumptions & predilections are a response to a more immediate “environment” than the environment of evolutionary adaptation.
- And I exercise free will over how I respond to the most immediate “environment” which is just the stimuli I get from you and the Wu Tang Clan.

**UPDATE 2:** As I think through this again, I feel quantum measurement really is a great metaphor for interacting with people. You only evoke one particular response-complex from a person on that particular time. And the way you evoke it perturbs the “objective” underlying thing. For example if yo’re introduced to someone in a flirtatious way versus in a business setting.