News for hackers. Stuff that matters.

hardmath123

Re:Decorator JITs: Python as a DSL on Monday February 03, 2025 @05:08PM (#42923949)
Here's another blog post on this theme! https://github.com/kach/art-deco/blob/main/art-deco.ipynb
Re: Low FPS webcam - here's an approach that attempts to analyze coin tossing data from the _sound_ rather than the _video_, since sound is typically recorded at a much higher sampling rate (high enough to "hear" the spinning of the coin). https://cs.stanford.edu/~kach/can-one-hear-the-fate-of-a-coi...
Relatedly: The Second Eigenvector of the Google Matrix

https://nlp.stanford.edu/pubs/secondeigenvalue.pdf

Re:Penrose – Penrose on Monday January 15, 2024 @02:15AM (#38998215)
A lot of replies here are missing the key idea behind Penrose: that the "substance" and "style" of any mathematical diagram are separable. For example, the "substance" of a diagram might be a collection of sets with known subset relationships:

Set A, B, C

IsSubset(B, A)

IsSubset(C, A)

That same substance can then be rendered in many different styles, e.g. as a Venn diagram or as a tree diagram (substance vs. style is a lot like HTML vs. CSS). Importantly, Penrose's vision is that experts will author libraries of domains and styles, and end-users need only express the substance of their diagrams (i.e. the three lines of code above).

The second beautiful idea in Penrose is that diagram generation is expressed as a constrained optimization problem. This lets you easily experiment with layouts by writing constraints and sampling a variety of potential diagrams via stochastic search.

These two ideas set Penrose apart from most other diagram software out there. I really hope it gains wider adoption. Give it a try!

Re:Wordles of the World on Tuesday February 01, 2022 @10:58AM (#30164220)
I was inspired by this Rest of World post https://restofworld.org/2022/wordle-viral-turkish-japanese-t... to make a Hindi-language "Wordle" https://kach.github.io/shabdle/ just for fun. It was a little tricky figuring out how to adapt the game for Hindi's script, but I'm quite happy with my solution of using U+25CC ("dotted circle") to mark missing consonants.
Re:A stochastic method to generate the Sierpinski triangle on Monday December 27, 2021 @10:55AM (#29703497)
Indeed, you can "learn" (by gradient descent) new parameters to this algorithm, to generate fractals in any target shape that you want! https://hardmath123.github.io/chaos-game-fractal-foliage.htm...
This reminds me of a small experiment I did with a friend, where we asked different people to independently write the HTML and CSS for a website (without communicating), and then put the HTML and CSS files together to see how well they worked. https://kach.github.io/generative-adversarial-web-developmen...
Re:Show HN: CookLang – Recipe Markup Language on Tuesday October 26, 2021 @08:34AM (#28999590)
You might also like this little book, "Computational Cooking," which is also, in a way, a meditation on the language of recipes. http://diyhpl.us/~bryan/papers2/CompCook.html
Re:Moiré No More on Sunday September 26, 2021 @04:15PM (#28664253)
If you liked this, you might enjoy this little trick you can do with moiré patterns -- near the end of the post, I talk a little bit about the math behind the FFT connection. https://hardmath123.github.io/moire.html
I don't know about "practical," but you might enjoy this: https://github.com/kach/recreational-rosette
Re:Uppestcase and Lowestcase Letters on Thursday April 01, 2021 @10:23PM (#26668504)
See also: "Words that do Handstands" (2019), where similar tricks are used to hallucinate an ambigram font!

https://news.ycombinator.com/item?id=20820036

http://hardmath123.github.io/ambigrams.html

Re:Show HN: Online Interactive Parser on Thursday March 18, 2021 @05:44PM (#26507886)
You might also like the nearley playground, which lets you write a grammar in BNF and see all possible parsings of an input. You can even press a button and generate a random string that matches your grammar! https://omrelli.ug/nearley-playground/
Re:Finding Mona Lisa in the Game of Life on Monday March 08, 2021 @09:37AM (#26386195)
See also, a post from mid-2020 that does something similar with a "softened" Life: http://hardmath123.github.io/conways-gradient.html
Re:Finding Mona Lisa in the Game of Life on Monday March 08, 2021 @09:35AM (#26386174)
Similar post from mid-2020, using PyTorch instead of JAX, and using a "continuous" (gradient-based) hill-climbing: http://hardmath123.github.io/conways-gradient.html

And the HN discussion from the time: https://news.ycombinator.com/item?id=23095190

Re:Can One Hear the Shape of a Drum? [pdf] on Tuesday March 02, 2021 @07:33PM (#26323217)
Relatedly: Can one hear the fate of a coin? https://cs.stanford.edu/~kach/can-one-hear-the-fate-of-a-coi...
Re:Applicative Parsing on Monday March 01, 2021 @05:03PM (#26309060)
Parsers in nearley.js [1] are written in a very readable EBNF-like DSL; then they get desugared down to a JS file that's a lot like your snippet.

[1] https://github.com/kach/nearley

Re:Show HN: CalcuLaTeX, a pretty-printing calculator language on Thursday February 25, 2021 @06:37PM (#26269784)
You might like Frink! https://frinklang.org
Re:Self-organising textures from cellular automata on Friday February 12, 2021 @11:24AM (#26115311)
See also: using differentiable approximations of cellular automata in PyTorch to reverse Conway's Game of Life; in some cases, you can get striking Turing patterns similar to what's described in this paper! http://hardmath123.github.io/conways-gradient.html
Re:Learning to Play the Chaos Game on Sunday December 27, 2020 @12:23PM (#25552514)
How cool! I was on the fence about whether or not to put up the source code— I'm _glad_ I did!

Do you have a recommendation for a good reference that teaches about the various metrics for point-cloud distance? (I only used Chamfer distance because I hazily recalled it from some undergrad class taken a while ago...)

Older »