spraci.info

Yesterday I posted on

@TopologyFact

The uniform limit of continuous functions is continuous.

John Baez replied that this theorem was proved by his "advisor's advisor's

advisor's advisor's advisor's advisor." I assume he was referring to Christoph

Gudermann.

The impressive thing is not that Gudermann was able to prove this simple

theorem. The impressive thing is that he saw the need for the concept of

uniform convergence. My impression from reading the Wikipedia

article on uniform

convergence is that Gudermann alluded to uniform convergence in passing and

didn't explicitly define it or formally prove the theorem above. He had the

idea and applied it but didn't see the need to make a fuss about it.... Show more...

Suppose you have a computer that can evaluate and compose continuous functions

of one real variable and can do addition. What kinds of functions could you

compute with it? You could compute functions of one variable by definition,

but could you bootstrap it to compute functions of two variables?

Here's an example that shows this computer might be more useful than it seems

at first glance. We said it can do addition, but can it multiply? Indeed it

can [1].

We can decompose the function

into

where

So multiplica... Show more...

The first step in solving a cubic equation is to apply a change of variables

to reduce an equation of the form

to one of the form

This process can be carried further through Tschirnhausen transformations, a

generalization of an idea going back to Ehrenfried Walther von Tschirnhaus in

1683.

For a polynomial of degree

rational change of variables

turning the equation

into

The so-called "leapfrog" integrator is a numerical method for solving

differential equations of the form

where

This form of equation is common for differential equations coming from

mechanical systems. The form is more general than it may seem at first. It

does not allow terms involving first-order derivatives, but these terms can

often be eliminated via a change of variables. See this

post

for a way to eliminate first order terms from a linear ODE.

The leapfrog integrator is also known as the Störmer-Verlet method, or the

Newton-Störmer-Verlet method, or the Newton-Störmer-Verlet-leapfrog meth... Show more...

There are only two nations in the world whose existence seems to be founded primarily on #historical #myths. In the US, false historical #mythology permeates every nook and cranny of the #American #psyche, the result of more than 100 years of astonishing and unconscionable programming and #... Show more...

Let Ω be an open set in some Euclidean space and

Ω.

Dirichlet's integral for

Among functions with specified values on the boundary of Ω, Dirichlet's

principle says that minimizing Dirichlet's integral is equivalent to solving

Laplace's equation.

In a little more detail, let

of the region Ω. A function

requirement that

equation

... Show more...

You can read the title of this post as ((Morse code) golf) or as (Morse (code

golf)).

Morse code is a sort of approximate Huffman coding of letters: letters are

assigned symbols so that more common letters can be transmitted more quickly.

You can read about how well Morse code achieves this design objective

[here](https://www.johndcook.com/blog/2017/02/08/how-efficient-is-morse-

code/).

But digits in Morse code are kinda strange. I imagine they were an

afterthought, tacked on after encodings had been assigned to each of the

letters, and so had to avoid encodings that were already in use. Here are the

assignments:

`|-------+-------| `

| Digit | Code |

|-------+-------|

| 1 | .---- |

| 2 | ..--- |

| 3 | ...-- |

| 4 | ....- |

| 5 | ..... |

| 6 |

... Show more...
#field #help #human #math #might #mysteries #obscure #perception #unlock

How hyperbolic geometry, once considered mathematical heresy, could help us understand human perception.

I've written several times about the "squircle," a sort of compromise between

a square and a circle. It looks something like a square with rounded corners,

but it's not. Instead of having flat sizes (zero curvature) and circular

corners (constant positive curvature), the curvature varies

continuously.

A natural question is just what kind of circle approximates the corners. This

post answers that question, finding the radius of curvature of the osculating

circle.

The squircle has a parameter

circle or a square.

... Show more...

Politically leaning towards #libertarian , while trying to get out of my bubble

A while back I ran across a paper [1]giving a trick for evaluating integrals

of the form

where

integral is asymptotically

That is, the ratio of

infinity.

This looks like a strange variation on [Laplace's

approximation](https://www.johndcook.com/blog/2017/12/19/laplace-approx-

logistic/). And although Laplace's method is often useful in practice, no

applications of the approximation above come to mind. Any ideas... Show more...

A parabola and a catenary can look very similar but are not the same. The

graph of

is a parabola and the graph of

is a catenary. You've probably seen parabolas in a math class; you've seen a

catenary if you've seen the St. Louis arch.

Depending on the range and scale, parabolas and catenaries can be too similar

to distinguish visually, though over a wide range enough range the exponential

growth of the catenary becomes apparent.

For example, for

match a catenary so well that the graphs practically overlap. The blue curve

is a catenary and the orange curve is a parabola.

... Show more...

Sam Walters

posted an

elegant theorem on his Twitter account this morning. The theorem follows the

pattern of an equality for linear functions generalizing to an inequality for

convex functions. We'll give a little background, state the theorem, and show

an example application.

Let

×

Hermitian matrix equals its conjugate transpose, which means the elements on

the diagonal equal their own conjugate.)

A general theorem says that

λ 1, λ... Show more...

Someone asked an interesting question on

[MathOverflow](https://mathoverflow.net/questions/363083/hamming-distance-to-

primes): given an odd number, can you always flip a bit in its binary

representation to make it prime?

It turns out the answer is no, but apparently it is very often the case an odd

number

Someone pointed out that 2131099 is not a bit flip away from a prime, and that

this may be the smallest example. The counterexample 2131099 is itself prime,

so you could ask whether an odd number is either a prime or a bit flip away

from a prime. Is this always the case? If not, is it often the case?

The MathOverflow question was stated in terms of Hamming distance, counting

the number of bits in which two bit sequences differ. It asked whether odd... Show more...

Mathematics is a language. A language, that for as much as any individual may hope to do so, demands to "say what you mean" divorced of emotional driven poetic abstracts.

Phonetic and otherwise written languages of "word", counter to the language of math, concern themselves first and foremost with abstract poetics. The definition of every word in and of itself to be found in nothing but more words and never anything concrete.

Gematria, which ascribes numerical values to correspondence with the written word and subsequently also phonetics is both a language of (more precise) "meaning" and abstract poetics. Of synthesis, the idea of any meaningful gematria existing to unite these seeming polar opposites is in itself impressive. The fact that numerous gematria language systems stand in existence, notably in any sort of meaningful "large scale" use and modularity, may be consid... Show more...

After finding the NASA publication I mentioned in my previous

post, I

poked around a while longer in the NASA Technical Reports

Server and found a few curiosities. One was

that at one time NASA was interested in shapes that similar to the

[superellipses](https://www.johndcook.com/blog/2014/06/07/swedish-

superellipse/) and [squircles](https://www.johndcook.com/blog/2018/02/13

/squircle-curvature/) I've written about before.

A report [1]that I stumbled on was concerned with shapes with boundary

described by

... Show more...

NASA's Orbital Flight

Handbook, published in 1963,

is a treasure trove of technical information, including a section comparing

the strengths and weaknesses of several numerical methods for solving

differential equations.

The winner was a predictor-corrector scheme known as Gauss-Jackson, a method I

have not heard of outside of orbital mechanics, but one apparently

particularly well suited to its niche.

The Gauss-Jackson second-sum method is strongly recommended for use in... Show more...

either Encke or Cowell [approaches to orbit modeling]. For comparable

accuracy, it will allow step-sizes larger by factors of four or more than any

of the forth order methods. … As compared with unsummed methods of comparable

accuracy, the Gauss-Jackson method has the very important advantage that

roundoff error growth is inhibited. … The

Polynomials form a vector space—the sum of two polynomials is a polynomial

etc.—and the most natural basis for this vector space is powers of

1,

But the power basis is not the only possible basis, and often not the most

useful basis in application.

In some applications the

positive integers

Falling powers come up in

combinatorics, in the [calculus

of finite differences](https://www.j... Show more...

Many methods for numerically solving ordinary differential equations are

either Runge-Kutta methods or linear multistep methods. These methods can

either be explicit or implicit.

The table below shows the four combinations of these categories and gives some

examples of each.

step at a time. That is, these methods approximate the solution at the next

time step using only the solution at the current time step and the

differential equation itself.

using the computed solutions at the latest several time steps.

function of othe... Show more...

Before I went to college, I'd heard that it took new math and science for

Apollo to get to the moon. Then in college I picked up the idea that Apollo

required a lot of engineering, but not really any new math or science. Now

I've come [full circle](https://www.johndcook.com/blog/2011/01/25/coming-full-

circle/) and have some appreciation for the math research that was required

for the Apollo landings.

Celestial mechanics had been studied long before the Space Age, but that

doesn't mean the subject was complete. According to One Giant

Leap,

In the weeks after Sputnik, one Langley [Research Center] scientist went... Show more...

looking for books on orbital mechanics

Here's a plot of exp(6

Notice that the plot has 7-fold symmetry. You might expect 6-fold symmetry

from looking at the equation. Where did the 7 come from?

I produced the plot using the code from this

post, changing the

line defining the function to plot to

`def f(t): `

return exp(6j*t)/2 + exp(20j*t)/3

You can find the solution in Eliot's comment in this Twitter

thread.

* Daily exponential sum

* Mystery curve

http://feedproxy.google.com/~r/TheEndeavour/~3/pbTiXx1430Q/

#johndcook #Math

I realized recently that I've written about generalized Gibbs phenomenon, but

I haven't written about its original context of Fourier series. This post will

rectify that.

The image below comes from a previous post illustrating Gibbs phenomenon for a

Chebyshev approximation to a step function.

Although Gibbs phenomena comes up in many different kinds of approximation, it

was first observed in Fourier series, and not by Gibbs [1]. This post will

concentrate on Fourier series, and will give an example to correct some wrong

conclusions one might draw about Gibbs phenomenon from the most commonly given

examples.

The uniform limit of continuous function is continuous, and so the Fourier

series of a function cannot converge uniformly where the function is

discontinuous. But what

My first consulting project, right after I graduated college, was developing

floating point algorithms for a microprocessor. It was fun work, coming up

with ways to save a clock cycle or two, save a register, get an extra bit of

precision. But nobody does that kind of work anymore. Or do they?

There is still demand for novel floating point work. Or maybe I should say

there is once again demand for such work.

Companies are interested in low-precision arithmetic. They may want to save

memory, and are willing to trade precision for memory. With deep neural

networks, for example, quantity is more important than quality. That is, there

are many weights to learn but the individual weights do not need to be very

precise.

And while some clients want low-precision, others want extra precision. I'm

usually skeptical when someone tells me they need extended precision because

typically they just need a better al... Show more...

In [previous post](https://www.johndcook.com/blog/2020/06/09/complex-square-

root/) I showed how to compute the square root of a complex number. I gave as

an example that computed the square root of 5 + 12

(Of course complex numbers have two square roots, but for convenience I'll

speak of the output of the algorithm as

just its negative.)

I chose

perfect square because this simplified the exposition.That is, I designed the

example so that the first step would yield an integer. But I didn't expect

that the next two steps in the algorithm would also yield integers. Does that

always happen or did I get lucky?

It does not always happen.... Show more...

Suppose you're given a complex number

and you want to find a complex number

such that

ℓ = √(

For example, if

calculation confirms

(3 + 2

(That example worked out very nicely. More on why in the [next

post](https://www.johndcook.com/blog/2020/06/09/square-root-gaussian-

integer/).)

In a Fascinating Twist, Animals That Do Math Also Understand More Language Than We Think

It is often thought that humans are different from other animals in some fundamental way that makes us unique, or even more advanced than other species. These claims of human superiority are sometimes used to justify the ways we treat other animals,

Here is a plot of the first 30 Chebyshev polynomials. Notice the interesting

patterns in the white space.

Forman Acton famously described Chebyshev polynomials as "cosine curves with a

somewhat disturbed horizontal scale.” However, plotting cosines with

frequencies 1 to 30 gives you pretty much a solid square. Something about the

way Chebyshev polynomials disturb the horizontal scale creates the interesting

pattern in negative space.

* Product of Chebyshev polynomials

* Chebyshev approximation

* Yogi Berra meets Chebyshev

http://feedproxy.google.com/~r/TheEndeavour/~3/YjSJZ3GH_48/

#johndcook #Math #Specialfunctions

Suppose you fill two

probability that the determinants of the two matrices are relatively prime? By

"random integers" we mean that the integers are chosen from a finite interval,

and we take the limit as the size of the interval grows to encompass all

integers.

Let Δ(

have relatively prime determinants. The function Δ(

decreasing function of

The value of Δ(1) is known exactly. It is the probability that two random

integers are relatively prime, which is well known to be 6/π². I've probably

blogged about this before.

The limit of Δ(

McCurley constant [1], which has been computed to be 0.3532363719…

... Show more...

If a function is smooth and has thin tails, it can be well approximated by

sinc functions. These approximations are frequently used in applications, such

as signal processing and numerical integration. This post will illustrate sinc

approximation with the function exp(-

The sinc approximation for a function

where sinc(

Do you get more accuracy from sampling more densely or by sampling over a

wider range? You need to do both. As the number of sample points

increases, you want

increase something like √

According to [1], the best trade-off between smaller

The most obvious way to compute the determinant of a 2×2 matrix can be

numerically inaccurate. The biggest problem with computing

if

precision. William Kahan developed an algorithm for addressing this problem.

Kahan's algorithm depends on a

computes

approach would use two.

In more detail, the fused multiply-add behaves as if it takes its the floating

point arguments

real numbers, calculates

to the world of floating point numbers. The true value of

Given a curve of a fixed length, how do you maximize the area inside? This is

known as the isoperimetric problem.

The answer is to use a circle. The solution was known long before it was

possible to prove; proving that the circle is optimal is surprisingly

difficult. I won't give a proof here, but I'll give an illustration.

Consider a regular polygons inscribed in a circle. What happens to the ratio

of area to perimeter as the number of sides increases? You might suspect that

the ratio increases with the number of sides, because the polygon is becoming

more like a circle. This turns out to be correct, and it's not that hard to be

precise about what the ratio is as a function of the number of sides.

For a regular polygon inscribed in a circle of radius

and

... Show more...

The curse of dimensionality refers to problems whose difficulty increases

exponentially with dimension. For example, suppose you want to estimate the

integral of a function of one variable by evaluating it at 10 points. If you

take the analogous approach to integrating a function of two variables, you

need a grid of 100 points. For a function of three variables, you need a cube

of 1000 points, and so forth.

You cannot estimate [high-dimensional

integrals](https://www.johndcook.com/blog/2015/07/19/high-dimensional-

integration/) this way. For a function of 100 variables, using a lattice with

just two points in each direction would require 2100 points.

There are much more efficient ways to approximate integrals than simply adding

up values at grid points, assuming your integrand is smooth. But when applying

any of... Show more...

https://global.chinadaily.com.cn/a/202005/28/WS5ecf121ca310a8b24115906b.html

Kelsang Dekyi has relied on knowledge to change her destiny, so it's no surprise she believes education has the power to change people's lives.

#China #Chinese #Tibet #education #reform #Mandarin #math #school

Kelsang Dekyi has relied on knowledge to change her destiny, so it's no surprise she believes education has the power to change people's lives.

It's hard to understand anything from just one example. One of the reason for

studying other planets is that it helps us understand Earth. It can even be

helpful to have more examples when the examples are purely speculative, such

as xenobiology, or even known to be false,

[counterfactuals](https://www.johndcook.com/blog/bayesian-networks-causal-

inference/), though here be dragons.

The fundamental theorem of arithmetic seems trivial until you see examples of

similar contexts where it isn't true. The theorem says that integers have a

unique factorization into primes, up to the order of the factors. For example,

12 = 2² × 3. You could re-order the right hand side as 3 × 2², but you can't

change the list of prime factors and their exponents.

I was unimpressed when I first heard of fundamenta... Show more...

This post will take a familiar theorem in a few less familiar directions.

The Fundamental Theorem of Algebra (FTA) says that an

over the complex numbers has

high school algebra, but it 's not proved in high school and it's not proved

using algebra!

You're most likely to see a proof of the Fundamental Theorem of

course in complex

properties of the complex numbers, not just their algebraic properties. It is

an existence theorem that depends on the topological completeness of the

complex numbers, and so it cannot be proved from the algebraic properties of

the complex numbers alone.

(The dividing lines between areas of math, such as between algebra and

analysis, are not always objective or even useful. And for some odd reason,

some... Show more...

In the previous

post I

mentioned that Remez algorithm computes the best polynomial

approximation to a given function

That is, for a given

minimizes the absolute error

||

The Mathematica function

error by minimizing

|| (

As was pointed out in the comments to the previous post, Chebyshev

approximation produces a nearly optimal approximation, coming close to

minimizing the absolute error. The Chebyshev approximation can be

computed more easily and the results are easier to understand.

To form a Chebyshev approximation, we expand a function i... Show more...

The best polynomial approximation, in the sense of minimizing the

maximum error, can be found by the Remez algorithm. I expected

Mathematica to have a function implementing this algorithm, but

apparently it does not have one.

It has a function named

algorithm, and it’s close, but it’s not it.

To use this function you first have to load the

Then we can use it, for example, to find a polynomial approximation to

This returns the polynomial

`1.00003 + 0.999837 x + 0.499342 x^2 + 0.167274 x^3 + 0.0436463 x^4 + `

0.00804051 x^5

And if we plot the error, the difference between

polynomial, we see tha... Show more...

A maximum distance separable code, or MDS code, is a way of encoding

data so that the distance between code words is as large as possible for

a given data capacity. This post will explain what that means and give

examples of MDS codes.

A linear block code takes a sequence of

sequence of

2. More on that below.

The purpose of these codes is to increase the ability to detect and

correct transmission errors while not adding more overhead than

necessary. Clearly

has to pay for itself in terms of the error detection and correction

capability it provides.

The ability of a code to detect and correct errors is measured by

the minimum dis... Show more...

#NotTheOnion #MSM #Media #FakeNews #imbeciles #stupidity #MSDNC #NewYorkTimes #NYT #LeftistMedia #Leftism #rofl #humor #fun #lol #lmao #math #maths #mathematics

Someone asks a programmer if all odd numbers are prime.

The programmer answers:

"Wait a minute, I think I have an algorithm from Knuth on finding prime numbers... just a little bit longer, I've found the last bug... no, that's not it... ya know, I think there may be a compiler bug here - oh, did you want IEEE-998.0334 rounding or not? - was that in the spec? - hold on, I've almost got it - I was up all night working on this program, ya know... now if management would just get me that new workstation that just came out, I'd be done by now... etc., etc. ..."

I recently stumbled on a formula for the largest gap between consecutive

items in a row of Pascal’s triangle.

For

{.aligncenter

.size-medium width="363" height="43"}

where

{.aligncenter

.size-medium width="154" height="39"}

For example, consider the 6th row of Pascal’s triangle, the coefficients

of (

1, 6, 15, 20, 15, 6, 1

The largest gap is 9, the gap between 6 and 15 on either side. In our

formula

τ = (8 – √8)/2 = 2.5858

and so the floor of τ is 2. The equation above says the maximum gap

should be between the binomial co... Show more...

Take a positive integer

the same to the result, over and over. What happens?

To find out, let’s write a little Python code that sums the squares of

the digits.

`def G(x): `

return sum(int(d)**2 for d in str(x))

This function turns a number into a string, and iterates over the

characters in the string, turning each one back into an integer and

squaring it.

Now let’s plot the trajectories of the iterations of G.

`def iter(x, n): `

for _ in range(n):

x = G(x)

return x

for x in range(1, 40):

y = [iter(x, n) for n in range(1, 12)]

plt.plot(y)

This produces the following plot.

{.aligncenter .size-medium

width="640" height="480"}

Fo... Show more...

Heron’s formula computes the area of a triangle given the length of each

side.

{.aligncenter

.size-medium width="220" height="22"}

where

{.aligncenter .size-medium

width="102" height="37"}

If you have a very thin triangle, one where two of the sides

approximately equal

implementation Heron’s formula may not be accurate. The cardinal rule of

numerical programming is to avoid subtracting nearly equal numbers, and

that’s exactly what Heron’s formula does if

to two of the sides, say

William Kahan’s formula is algebraically equivalent... Show more...

I recently stumbled on a paper [1]that looks at a cubic equation that

comes out of a problem in orbital mechanics:

σ

Much of the paper is about the derivation of the equation, but here I’d

like to focus on a small part of the paper where the author looks at two

ways to go about solving this equation by looking for a fixed point.

If you wanted to isolate

get

If you work in the opposite direction, you could start by taking the

square root of both sides and get

Both suggest starting with some guess at

unique solution for any σ > 4 and so for our example we’ll fix σ = 5.

We define two functions to iterate, one for... Show more...

A couple days ago I wrote about Hamming

codes and

said that they are so-called

Hamming’s upper bound on the number of code words with given separation

is exact.

Not only are Hamming codes perfect codes, they’re practically the only

non-trivial perfect codes. Specifically, Tietavainen and van Lint proved

in 1973 that there are three kinds of perfect binary codes:

- Hamming codes
- One Golay code
- Trivial codes

codes a few

months ago. There are two binary Golay codes, one with 23 bit words and

one with 24 bit words. The former is “perfect.” But odd-length words are

awkward to use, and in pract... Show more...