HNHacker News
TopNewBestAskShowJobs

jwmerrill

1,598 karma · joined April 5, 2012

Physicist, probability and geometry enthusiast, and software developer at https://www.desmos.com.

You can reach me at jwmerrill@gmail.com

submissionscomments
jwmerrill··on Math Keeps Changing
The default calculator on Android since Marshmallow apparently uses arbitrary precision arithmetic: https://m-cacm.acm.org/magazines/2017/8/219594-small-data-co...
jwmerrill··on Dogs poop in alignment with Earth’s magnetic field, study finds (2014)
Yes, you’re right about the minute hand. Oops.

“arch minute” is a term used in the article, but “arc minute” also sounds more standard to me.

jwmerrill··on Dogs poop in alignment with Earth’s magnetic field, study finds (2014)
To make it even more concrete: realize that the hour hand on a clock moves 6 degrees per minute (it takes 60 minutes to go all the way around, 360 degrees).

This study claims that variations of the earth’s magnetic field direction that are more than 100 times slower than this have measurable effects on the behavior of dogs.

jwmerrill··on Dogs poop in alignment with Earth’s magnetic field, study finds (2014)
This study hinges on binning by variability of the magnetic field. It’s important to realize how small these variations are. The authors measure variation in the field direction in “percent”, but the units are arch minutes (1/60 of a degree in compass heading) per minute of time [0]. Calling this a percentage is kind of an odd pun on two meanings of the word “minute”.

According to the authors’ own interpretation, variation of 2 arch minutes of heading per minute of time is enough to destroy the claimed effect. In other words, they’re talking about a 0.03 degree change in direction in the amount of time it takes a dog to poop.

Perhaps you believe dogs are sensitive to magnetic fields, but can you really believe that they are also sensitive to such tiny relative variations in magnetic fields? Much more sensitive than a handheld compass?

I also agree with the general criticisms about p-hacking, but I think it’s worth having some sense of the actual size of the thing the authors are talking about, and how implausible it all is, apart from any details of the statistics.

[0] See figure 4 in https://frontiersinzoology.biomedcentral.com/track/pdf/10.11...

jwmerrill··on More Intuitive Calculator Arithmetic (2018)
> "I’m also not aware of any calculator (or programming language) that currently works this way." [represent fractions exactly wherever reasonable to do so]

Author here. The paraphrase makes this sound wrong, but what I actually meant is that I don’t know of any calculator that uses rationals while the numerator and denominator can be represented as integer floating point doubles, and then falls back to a single floating point double if the numerator or denominator overflow.

I am aware of many systems that use arbitrary precision rationals, and I mentioned this in the post:

> Rational numbers where the numerator and denominator are allowed to grow arbitrarily large are used by computer algebra systems (CAS) like Mathematica and Maple (and also some high-end handheld graphing calculators).

jwmerrill··on Geometry, Algebra, and Intuition (2017)
You might like some of the other posts on the blog! I’ve written several other posts showing how Geometric Algebra can be used in plane geometry problems that would typically be treated with lengths and angles.

Most recent post, which links to other parts of the series: https://www.shapeoperator.com/2019/02/10/proving-theorems-ab...

An older post applying GA to the geometry of sunsets: https://www.shapeoperator.com/2016/12/12/sunset-geometry/

jwmerrill··on New Proof Settles How to Approximate Numbers Like Pi
> 355/113 is more precise 1/(113^2) ~ 0.00008 and the fraction is still possible to be stored in 16-bit

log2(355)+log2(113)≈15.3, so it seems like you could squeeze this into 16 bits, but what about a sign bit? And since 355>2^8, I think you also need to be reserving some bits to say how the remaining bits are partitioned between the numerator and denominator (see [1] for an interesting writeup of some experiments with "floating bar").

A fundamental fact of any fixed width number format is that you can only represent 2^n values with n bits, so designing a number representation is really all about deciding how you will distribute those values. Some properties you might want:

1. Enough dynamic range for your application 2. A smooth distribution of values within that range (clustering some values too close together implies gaps somewhere else). 3. Efficient arithmetic operations 4. Exact results in some important cases

Floating point optimizes for 1-3, somewhat at the expense of 4 although it is exact for (small enough) integers and fractions with a (small enough) power of 2 in the denominator.

Fixed-width rationals are less good at 1-3, but are better for 4. The distribution of rationals on the number line is pretty funky, and there's even redundancy because 2/4 and 1/2 represent the same value.

I don't think optimizing for exact results in more special cases is really the right move in most applications, so I don't think we should be surprised by floating point's dominance. On the other hand, I have worked on a project where we decided exact results in special cases really was important [2].

[1] https://iquilezles.org/www/articles/floatingbar/floatingbar.... [2] https://engineering.desmos.com/articles/intuitive-calculator...

jwmerrill··on More Google Employees Are Losing Faith in Their CEO's Vision
> even Einstein didn't remember how to do long division, he looked it up

Nitpick: the idea that Einstein struggled with school-level mathematics is a myth[1]. I would be very surprised if he ever had to look up the procedure for long division.

[1] http://content.time.com/time/specials/packages/article/0,288...

jwmerrill··on TypeScript in 5 minutes
Typescript has flags for turning on more strictness, and I highly recommend using them. For example, strictNullChecks for your example above.

There’s a “strict” flag that you can use to turn on most of the more specific strictness flags all at once.

jwmerrill··on 'Human brain' supercomputer with 1M processors switched on for first time
Good to know.

I think the writing in this article is not so good, but I've seen this usage by plenty of respectable writers. Stephen Hawking's "A Brief History of Time" is not comically bad writing, and it's full of even more outlandish usages of "million million million ..."

https://www.google.com/search?q=brief+history+of+time+"milli...

jwmerrill··on 'Human brain' supercomputer with 1M processors switched on for first time
I think 200 million million is a British English thing because of the long scale/short scale ambiguity:

https://en.m.wikipedia.org/wiki/Long_and_short_scales

jwmerrill··on Writing GUI Apps Using the Red Programming Language
According to Wikipedia, Mathematica was initially released in 1988. Rebol was first released in 1997.

Maybe Rebol inspired some part of Mathematica that came later, like the manipulate/dynamic system?

jwmerrill··on An adventure in trying to optimize math.Atan2 with Go assembly
Looks like grandparent probably meant g(x) = x/√(1+x²)

Looks like f(x)=x+x^3/5 gets you two decimal digits everywhere [1], and you could improve that with more terms in the polynomial.

Edit: you can derive f(x) by doing a series expansion of tanh(x)/√(1-tanh(x)²) about x=0, and Mathematica tells me the first few terms are

f(x) = x + x^3/6 + x^5/120 + x^7/5040 + O(x^9)

[1] https://www.desmos.com/calculator/zbyll5oeqk

jwmerrill··on Malta – Alphabet X’s latest grid-scale energy storage technology
This is a misunderstanding of Carnot cycle efficiency. The thing that makes the Carnot cycle special is that it is reversible. So in principle, you can get 100% of the mechanical energy that you put in back out again, by running the process in reverse.

The usual efficiency calculation for a Carnot cycle tells you what fraction of heat energy that's removed from the hot reservoir can be converted to mechanical work. This is always less than 100%.

However, when running the cycle in reverse as a heat pump, it is possible to transfer more than one Joule of energy from the cold reservoir to the hot reservoir per Joule of mechanical energy used. That's why the round trip efficiency from mechanical energy back to mechanical energy can be 100%.

I have no idea what the practical efficiency of this system can be. But it's wrong to immediately reject it on theoretical grounds.

jwmerrill··on The electric car has dropped out of favor in Denmark
It's probably a law of nature that prices won't stabilize somewhere where you could triple the price and sell 1/3 the quantity. At the higher price, revenue would be the same, but you only had to produce 1/3 of the goods, so profit is higher.

So if you were ever in this situation, you would probably expect price to rise until the slope of the demand curve changes.

jwmerrill··on Approximating sin(x) to 5 ULP with Chebyshev polynomials
These are good points in general, but I don't think they're relevant to the author's partitioning of PI to get extra precision near the zeros. The article does a good job of explaining exactly what's going on here, and has plots to prove that nothing is going catastrophically wrong.
jwmerrill··on Fourier transform – A math tool used in optics, MP3s, JPEGs and more (2013)
It's much easier to get an intuitive understanding of convolution directly in the time domain, without worrying about Fourier Transforms.

Convolution with a top-hat kernel is just a moving average. Each point of the output is the average of the input signal over a given radius about that point.

Convolution with other kernels is a weighted moving average. Each point of the output is the average of the input signal over a region with weights depending on the displacement from that point.

The Fourier Transform allows implementing convolution as multiplication in frequency space (because the Fourier transform turns translations into multiplications), which is sometimes formally useful, and sometimes more efficient to evaluate.

jwmerrill··on AsciiMath – An easy-to-write markup language for mathematics
It was open source before we started using it, but we're friends with the creators, so I can pass on the compliment.
jwmerrill··on AsciiMath – An easy-to-write markup language for mathematics
I wonder if it's gotten better since 2002-2004, which is when I used it a lot.

I'd be curious to hear what you think about the equation editor in Desmos[1] (full disclosure, my employer).

We use an open source WYSIWYG typesetting library called MathQuill[2]. The keystrokes you use are very similar to AsciiMath, but the result is direct editing of the typeset math. E.g. you type '_' to move into a subscript, '^' to move into a superscript, '/' to create a fraction, 'sqrt' to create a radical, etc.

I believe that I can edit much faster with this interface than with Microsoft Equation Editor, and that it's approximately similar difficulty to learn. But I'm biased.

[1] https://www.desmos.com/calculator

[2] http://mathquill.com/

jwmerrill··on AsciiMath – An easy-to-write markup language for mathematics
To everyone who says "why do we need this when we have LaTeX?" I ask the question "why do we need Markdown when we have HTML?"

The nice thing about Markdown is that it's quite legible in its source form, which makes it less distracting to edit. Same deal with AsciiMath and LaTeX: AsciiMath is more legible in its source form which means that it has lower overhead during editing.

One of these is more legible than the other:

  (f'(x^2+y^2)^2)/(g'(x^2+y^2)^2)
  \frac{f'\left(x^2+y^2\right)}{g'\left(x^2+y^2\right)^2}
In my experience, most people who learn LaTeX don't do so until sometime around the middle or end of their undergrad career (certainly in Physics--maybe mathematicians learn it sooner). Earlier than that, people struggle with junk like the Microsoft equation editor. No big deal?
jwmerrill··on Principle of Sufficient Reason
Atoms are an abstraction, just like the higher level abstractions you mention. They happen to be a very good/stable abstraction over the time/energy scales relevant to day-to-day life, but they too are made of pieces that can disintegrate, recombine, etc.

It's a mistake to assume that anything that can be analyzed in terms of smaller pieces is less real than the pieces. Neither is real, or both are.

jwmerrill··on Images and video showing extent of Oroville dam damage
Not an answer for this particular case, but there are lots of named hydrodynamic instabilities: https://en.wikipedia.org/wiki/Hydrodynamic_stability#Applica...
jwmerrill··on Whole Foods is struggling
People waste a lot of time arguing over charges of hypocrisy. In practice, it ends up being a way of shifting the conversation from the argument that someone is making to the person who is making it.

Hypocrisy isn't great, but practically everyone has been guilty of it in one way or another. So it's an easy charge to make that gets everyone worked up.

I don't know if we should tolerate hypocrisy, but I'd be in favor of talking about it less in favor of more direct and productive arguments.

jwmerrill··on Prime Number Spiral
You (re)discovered dual numbers!

https://en.m.wikipedia.org/wiki/Dual_number

jwmerrill··on Information Geometry
Skilling wrote a nice critique of information geometry that's worth reading:

http://djafari.free.fr/MaxEnt2014/papers/Tutorial4_paper.pdf

The main point is that KL-divergence is not a metric, so imagining it as a distance in a space may give you some wrong intuitions. Its matrix of 2nd derivatives, the Fischer Information, works as a local metric, but then many people want to draw global pictures that try to extend this back to a global metric, which doesn't actually work.

jwmerrill··on Epson customers report Google Cloud Print causing printers to power down
But they won't be sold for $89 at Best Buy.
jwmerrill··on From Chrome Apps to the Web
The article mentions using Electron or NW.js if you want to continue building apps on web technologies that need deeper platform access.

Is there a reason that those are worse options than Chrome apps?

jwmerrill··on The Deconstructed Standard Model Equation
A lot of mathematical notation is optimized for hand-written algebra.

One of the main things you "do" with expressions like these is to transform them into equivalent expressions that have some desirable form, or examine special cases that allow simplifications, or examine the result of applying some additional operation.

Compact symbols and single letter variables reduce the amount of writing you need to do for each step of such transformations, but they also make the "structure" of expressions more visually obvious.

Programmers also spend time transforming programs into equivalent programs (aka refactoring), but refactoring isn't quite as important to programmers as algebra is to mathematicians and physicists, so (popular) programming languages don't optimize for it to quite the same degree.

jwmerrill··on Rustls: new, modern TLS library written in Rust
New Jersey style is a reference to Richard Gabriel's "Worse is better" essay.

[1] https://en.m.wikipedia.org/wiki/Worse_is_better

[2] http://dreamsongs.com/WorseIsBetter.html

jwmerrill··on IonMonkey now has Scalar Replacement and Branch Pruning optimizations
There's some information about how to collect (and visualize!) JS compilation artifacts in the IRHydra documentation [1]. It's v8 specific, though.

The other writings on that site are worth studying if you want to learn more about how v8 optimizes code [2].

[1] http://mrale.ph/irhydra/2/

[2] http://mrale.ph

← PreviousPage 2 of 8Next →