Ah, new ways to fold a cube dropped

Or, Erik Demaine et al. present cube-folding puzzles and results — such as folding a cube from a 3x3 square on half-unit lines and diagonals (close to the non-grid minimum of \(2\sqrt{2} \times 2\sqrt{2}\), or from a 2x5 rectangle with a slit with folds on a unit grid!

The 2x5 grid-fold puzzle initially looked impossible to me, so I made a paper model — and it turns out not only is it possible, it's also reasonably stable!

youtube.com/watch?v=wJPnXF5L3j

Integer bit shifts greater than the type bit width (which are undefined in C and C++ — for instance, mathstodon.xyz/@neilbickford/1 shows how this undefined behavior results in pseudorandom output) are interesting. LLVM doesn't define `shl` here, but Rust does: by bitmasking the right operand!

So 1u32 << 32 is a compile-time error, a panic with debug_assert! enabled, and 1 without debug_assert! (since (1u32 << 32) == (1u32 << 0) == 1). Via github.com/rust-lang/rust/blob and play.rust-lang.org.

Show thread

Yesterday I learned signed integer overflow is defined in Rust—it'll panic when debug_assert! is enabled (wrapping_add avoids this), but otherwise it'll wrap using 2's complement math!

In LLVM IR, rustc emits
add i32
while clang emits
add nsw i32

So Matt Pharr's Sobol infinite loop UB test from pharr.org/matt/blog/2021/11/26 would panic in debug (without wrapping_mul) but work correctly in release.

Though, this prevents LLVM's optimizer assuming that x+1>x for any int x. huonw.github.io/blog/2016/04/m

Then this differential equation for \(\wp(z)\) lets you simplify polynomials of \(\wp(z)\), and that gets really surprising because it means you can use it to express roots of general quintic polynomials (see equation (13) of Tomas Johansson's diva-portal.org/smash/get/diva)!

I guess it feels odd to me that working with elliptic functions is (in some sense) nicer than e.g. the problem of finding the closest point to an ellipsoid in 3D (which requires finding roots of non-solvable sextic polynomials)!

Show thread

What's also amazing is how quick it is to get this!

Take the power series for \(\wp(z)\) around any pole. Up to z^6, that only has non-0 coefficients for z^-2, z^2, and z^4. So the set of functions \(\wp(z),\wp(z)^3,\wp'(z)^2\), and \(1\) only have non-0 terms for z^-6, z^-2, and 1 - so there's a nontrivial linear combination that has no poles at all, and a constant term of 0!

Since \(\wp(z)\) is periodic+entire over C, it's constant—so since the constant term is 0, the whole sum's equal to 0!

Show thread

I've been thinking about the Weierstrass P elliptic function \(\wp(z)\) recently—it's still kind of surprising to me that it satisfies the differential equation \(\wp'(z)^2 = 4\wp(z)^3-g_2\wp(z)-g_3\) (where \(g_2, g_3\) are the lattice invariants) since that means the elliptic curve \(y^2=4x^3-g_2x-g_3\) is parameterized by \((\wp(z),\wp'(z))\)—& more generally, for any E.C./\(\mathbb C\) there's some lattice where \((\wp(z),\wp'(z))\) parameterizes it! I made this to try to understand it more.

ah, hmm, that's, uh, not supposed to happen when one clicks the Windows File Explorer taskbar item, is it? What've I done now?

(Don't worry — a restart fixed this!)

The first part of the garages' new covers double album premieres in about an hour and 20 minutes from now! youtu.be/-N0T9H9vfAI

From the garages (the band) at twitter.com/thegaragesband/sta :
TRIBUTE ACT 3: DECLASSIFIED // UNEARTHED is here. This album is so packed with incredible garages cover songs that we can't contain it to just 1 album.

PART 1 (DECLASSIFIED) is available for pre-order now & will premiere on youtube tomorrow, Fri 10 June! thegarages.bandcamp.com/album/

Idea: A newsletter named "Borges Biweekly"; subscribers receive an email both twice a week and every two weeks. The entire content of each email is a link to the previous email. The chain of links appears to continue indefinitely; there is no first email*

*(this is a joke and not an actual project, but I guess it could be possible with a server generating emails from arbitrary dates in the past as they're requested!)

I finally have one of these C++ puzzles!

Consider the following C++ program:
<stdio.h>

int main() {
unsigned int foo = (1u << 32) - 1u;
printf("%u\n", foo);
}

What do you think clang will make of this when compiling for x86_64-linux-gnu? (UB = undefined behavior)

Here's two views of tonight's lunar eclipse! I don't have a telescope, so these were taken with a Canon T6s and a 24-135mm zoom lens, but I'm pretty happy with the result!

These are each 5 2-second exposures merged together; there are some alignment artifacts, but as a way to reduce noise and cut through the haze it's really effective!

(I came up with two toots of plausible answers for this one; page 2/2)

The answer may be surprising; answers and explanation (as far as I got) here! godbolt.org/z/s4TG5Wzdj

Show thread

Question 2: If it compiles (whether or not it has UB), what will the program generated by clang targeting x86_64-linux-gnu print?

(I came up with two toots of plausible answers for this one; page 1/2)

Show thread

I finally have one of these C++ puzzles!

Consider the following C++ program:
<stdio.h>

int main() {
unsigned int foo = (1u << 32) - 1u;
printf("%u\n", foo);
}

What do you think clang will make of this when compiling for x86_64-linux-gnu? (UB = undefined behavior)

A quick experiment in plotting how Gray-Scott reaction-diffusion patterns change with respect to its two parameters: shadertoy.com/view/fdBXzy

so um, I was going to spend tonight answering your questions about the updates from the conference I posted earlier...

but I'm more than a little distracted by the supreme court getting ready to overturn my rights as a uterus holder in this country.

I'm worth more than my uterus.

It looks like last year's Gathering for Gardner exchange book is now online, so I can finally release the paper I wrote for it!

It's about how unit quaternions work, and why any rotation is represented by two quaternions (spoiler: the space of rotations isn't simply connected, so you can't blend paths of rotations without this duplication!): dropbox.com/s/mxwfrgw6pv9vihj/

Also includes 9 quaternion recipes, including why qxq^-1 rotates a vector, Frisvad-style tangent space generation, and more.

Via Bill Gosper, repeated Lanczos (truncated sinc) filtering on an image produces glitchy reaction-diffusion effects:

mathstodon.xyz/media/Z0PSlvCBA

The full reason this happens is because although the sinc filter is the ideal anti-aliasing filter in a mathematical sense (since it filters out all wavelengths shorter than a pixel), it has issues from Gibbs ringing which most modern filters (such as the Hamming and Blackman-Harris windows) try to avoid.

Show older
Mathstodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!