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!
Integer bit shifts greater than the type bit width (which are undefined in C and C++ — for instance, https://mathstodon.xyz/@neilbickford/108308574886769866 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 https://github.com/rust-lang/rust/blob/c274e4969f058b1c644243181ece9f829efa7594/compiler/rustc_codegen_ssa/src/common.rs#L131-L158%3E and https://play.rust-lang.org.
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 https://pharr.org/matt/blog/2021/11/26/debugging-renderers-unit-tests 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. https://huonw.github.io/blog/2016/04/myths-and-legends-about-integer-overflow-in-rust/
Bandcamp will donate their share of sales to the NAACP legal defense fund this Friday.
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 https://www.diva-portal.org/smash/get/diva2:926660/FULLTEXT01.pdf)!
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)!
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!
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.
The first part of the garages' new covers double album premieres in about an hour and 20 minutes from now! https://youtu.be/-N0T9H9vfAI
From the garages (the band) at https://twitter.com/thegaragesband/status/1535046491768766469 :
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! https://thegarages.bandcamp.com/album/ta031-declassified
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* #vpofideas
*(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:
#include <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! https://godbolt.org/z/s4TG5Wzdj
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)
I finally have one of these C++ puzzles!
Consider the following C++ program:
#include <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: https://shadertoy.com/view/fdBXzy
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!): https://www.dropbox.com/s/mxwfrgw6pv9vihj/G4G13%20-%20Why%20do%20the%20Unit%20Quaternions%20Double-Cover%20the%20Space%20of%20Rotations.pdf?dl=0
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:
https://mathstodon.xyz/media/Z0PSlvCBA65geIxSStI
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.
Developer Technology Engineer at NVIDIA! Rendering, mathematics, audio, and more. Sometimes records music about sharks and Blaseball. Opinions my own. Profile picture credit: http://twitter.com/neerajsamtani!