HN user

articulatepang

71 karma
Posts0
Comments27
View on HN
No posts found.

That's technically correct but consider the following:

You're implementing quicksort. The actual algorithm is a conceptual piece of math. You write the code. But sometimes the code produces output that isn't sorted.

The code "wins" in that whatever the code says is what actually happens. But the code is wrong. It must be edited to match the algorithm. The _algorithm_ is the thing that is proven correct; the _algorithm_ is what we wanted to execute. The code is a representation of the algorithm.

What do you mean not serious? He’s developing visual aids to teach students and to accompany his mathematical research papers. Also, not in this post, he’s been actively using LLMs to do real math research, that is, to prove theorems and solve problems.

Teaching, research and publication are the core activities of his job as a math professor. How does it get more serious than this?

Thank you and yes, I agree! It's neat to use the binomial theorem to see this, because that's the tool the article uses for the main trick/insight it's explaining.

I love complex analysis, and that's the branch of calculus that is most associated with number theory. For example, it was critical in the original proof of the prime number theorem and Dirichlet's theorem on primes in arithmetic progressions. Today, all kinds of number theoretic functions are studied using complex analysis, like the famous Riemann zeta function, Dirichlet L-functions, theta functions, and so on.

So that's what I expected this to be about. And it was super fun to see that it was actually not! Definitely learned something today.

I had to think about the following sentence for a bit: "We know that any integer x obeying f(x)≡0 (mod 125) must obey x≡2(mod 5)."

My explanation (it's basically all in the article, but here I spell it out): If f(x) = 0 (mod 125), then 125 divides f(x). Since 125 = 5^3, it must be that 5 also divides f(x). The only way for 5 to divide f(x) is for x = 2 (mod 5), by brute-forcing all solutions to f(x) = 0 (mod 5). Therefore for f(x) = 0 (mod 125), x = 2 (mod 5).

It's also worth saying why we only need to check all integers between 0 and n-1 when solving an equation mod n:

Suppose that for some integer y, f(y) = 0 (mod n) but y >= n or y < 0. Then for some x between 0 and n-1 (inclusive),

x = y (mod n).

Since the function f is a polynomial with integer coefficients, evaluating f on an integer involves only multiplication and addition by integers. Some crucial facts about congruences:

If x = y (mod n) then a + x = a + y (mod n) for any integer a. If x = y (mod n) then ax = ay (mod n) for any integer a. If x = y (mod n) then x^2 = y^2 (mod n), and similarly other integer powers.

From these we conclude that if x = y (mod n), then f(x) = f(y) (mod n) for any polynomial f.

So, for any y >= n with f(y) = 0 (mod n), there's some x between 0 and n-1 (inclusive) that also satisfies f(x) = 0 (mod n); in fact it's whatever integer in that range that y is congruent to. So we need only check integers in that range to find all possible solutions to f(x) = 0 (mod n).

Forgive me for the long explanation for what are of course elementary facts in number theory! I'm rusty on number theory so I had to explicitly work them out, so I figured maybe someone else might also benefit.

MacBook Neo 5 months ago

I've had a similar experience with Apple Store employees many, many times: I walk in and vaguely describe what I want, and they steer me to the cheapest item they sell that could possibly meet my stated requirements.

I've also returned Apple products multiple times, once (recently) without the packaging, and once several days past the return window. They refunded me every time, no questions asked.

This makes me wonder if it's part of their training?

Maybe you mean it's a crime to professionally provide advice of this nature without a license?

It is generally not a crime to casually provide advice of this nature without a license. For example, if my friend tells me, "My stomach hurts!", it is not a crime for me to say, "Just grin and bear it, it will be okay." If they subsequently die of appendicitis, I'm unlikely to have legal liability. It would be difficult to characterize what I said as medical diagnosis or treatment.

Similarly, I can tell my friend, "Don't bother paying your taxes, that is a waste of time." This is legal speech. (Of course, helping them evade taxes is another matter.)

What is illegal is to hold oneself out as a licensed doctor, lawyer or engineer, or to provide professional services without a license.

Of course, chatbots operate at scale and give the impression of being professionally qualified even though they don't make specific representations to that effect. You're directionally probably right and I agree with you, I just want to nitpick about what is and isn't criminal.

As you say, "the fundamental theorem of algebra relies on complex numbers" gets to the heart of the view that complex numbers are the algebraic closure of R.

But also, the most slick, sexy proof I know for the fundamental theorem of algebra is via complex analysis, where it's an easy consequence of Liouville's Theorem, which states that any function which is complex-differentiable and bounded on all of C must in fact be constant.

Like many other theorems in complex analysis, this is extremely surprising and has no analogue in real analysis!

You can think of it as returning an equivalence class if you like. Then it's single-valued.

More explicitly, it returns an equivalence class whose members are complex numbers that differ by integer multiples of 2*pi*i.

When it's important to distinguish members of the class, we speak of branches of the logarithm.

Also note the very cool and fun topology connection here. The keyword to search for is Riemann surface.

One technical point about resonance: the fourth-power law only applies when the driving frequency (i.e., the frequency of visible light) is far below the resonant frequency (which is in the UV region of the spectrum). The approximation breaks down the closer you get to the resonant frequency and also above.

I was confused about how a monotonic function (f^4) could possibly describe a resonance phenomenon (which ought to have a strong local extremum), and this is the answer.

For those who don’t know: the film City of God is based on this, and it’s a great movie. One of my all-time favorites. The directing, acting photography and storytelling are all very well done. Worth anyone’s time.

The money goes to the investors who sell.

The investors who sell are wealthier by amount $X because now they have fewer shares and more dollars.

The investors who don't sell are wealthier by the same amount $X because the shares they kept are worth more, because prices go up.

keeping the share price initially constant. This statement is definitely incorrect, unless you're being very technicaly and pedantic about "initially". You can think about it theoretically or you can look at empirical evidence. It is well-supported empirically that share prices go up after buybacks, and in fact they do so quantitatively by exactly the amount necessary for the equation implied above to hold.

Three things:

1. From the perspective of shareholders, and for the moment ignoring taxes, buybacks and dividends are exactly economically equivalent. If a dividend happens, you get some cash. If a buyback happens, the value of your shares goes up. Crucially, the amount by which each share's price goes up is equal to what the per-share dividend would have been. It's a useful exercise to work this out and convince yourself that it's true.

2. Now let's stop ignoring taxes. If a dividend happens, you get taxed that year. If the value of your shares goes up, you don't get taxed that year. Instead, you get taxed whenever you sell, which might be later when you retire and are in a lower tax bracket, or after a period of some years when you get a lower capital gains tax rate.

3. Now let's think about the effect of dividends vs buybacks on the allocation of your portfolio as a shareholder. Neither changes the total value of your portfolio -- that was point number 1, plus just plain old conservation of dollars, modulo taxes -- but a dividend increases the proportion of your investment that's in cash, while a buyback keeps it constant. Let's say you auto-invest all dividends in the S&P 500 or equivalent index fund. Then dividends reduce your ownership stake in the company, while buybacks keep it constant.

For these reasons, most investors prefer (or ought to prefer) buybacks: they have the same economic effect as dividends but allow you to defer taxes to whenever is optimal for you. Also, and this is a smaller point, if a company does a dividend then you have to actively do something (that is, buy stock) in order to maintain the same proportion of your portfolio in that company. In other words, if you want 10% of your savings to be in X, and they do a dividend, then you have to take the cash and buy shares of X. The reason this is a smaller point is that at least in theory you can get your brokerage to do this for you automatically.

There are some nuances where point number 1 fails to hold: signaling, bad execution of the buybacks, and principal-agent conflicts. The big example of that final point is executive compensation tied to specific share prices. I'm not an expert in this area so I don't know, off the top of my head, if there's real evidence either way that this effect is very large, but it's one that people will bring up so everyone who thinks about this ought to know about it.

This is great! Lovely to see a clean new codebase implementing quantum chemistry algorithms like Hartree-Fock. I remember using Molpro at my fist job. Venerable and comprehensive it may be, but it is some hoary Fortran code for sure.

I actually visited that link, and the answer seems to be

  "If you've seen my socials lately, you might have seen me talking about Ralph and wondering what Ralph is. Ralph is a technique. In its purest form, Ralph is a Bash loop.

    while :; do cat PROMPT.md | claude-code ; done

  Ralph can replace the majority of outsourcing at most companies for greenfield projects. It has defects, but these are identifiable and resolvable through various styles of prompts."

but the contents of PROMPT.md are behind a paywall. In spirit that is not so different from
  gcc program.c; ./a.out
while program.c is behind a paywall. It's nearly impossible to reason about what the system will do and how it works without knowing more about PROMPT.md. For example, PROMPT.md could say "Build the software" or it could say "Write formal proofs in lean for each function" or ...

In the spirit of curiosity, I'd appreciate a summary of a couple sentences describing the approach, aimed at a technically sophisticated audience that understands LLMs and software engineering, but not the specifics of this particular system.

This is so poorly written. What is "Ralph"? What is its purpose? How does it work? A single sentence at the top would help. The writer imagines that the reader cares enough to have followed their entire journey, or to decode this enormously distended pile of words.

More generally, I've noticed that people who spend a lot of time interacting with LLMs sometimes develop a distinct brain-fried tone when they write or talk.

Many tools offer offline file browsing and full text search. Anything from midnight commander to Alfred to ripgrep.

I think the valuable and difficult thing is high quality, fast, offline semantic search, including indexing (so my files don't go to your servers -- that's an immediate no-go for all the important industries).

I've tried my hand at this a couple times and it's hard! But really hope you succeed, because it would be a big game changer in how we organize and use information. Every company out there would buy this immediately.

Won’t this only work when connected to the internet? So I can’t use it on a flight.

Or if I work in finance, or healthcare, or law, or government, or a hardware design company, I don’t want my files leaving my network. Those are very important use cases, much more important than searching my personal laptop. I want this for WORK, not my little photo collection or notes or whatever.

This is a great use case for modern LLM/embedding models but gotta be local to be actually useful in the places where it’s most needed.

I don't think it's that silly. BusyBox packages a bunch of utilities in a single binary. It amortizes fixed costs: a single binary takes less space than 30 binaries that each do one tiny thing.

These are small bits of code, and the functionality is interrelated. The entire thing feels like a calculator, or awk, and seems reasonable to put in one binary.

The Unix philosophy doesn't actually say anything about whether different tools should live in the same binary. It's about having orthogonal bits of functionality and using text as the universal interface. BusyBox is just as Unix as having all the tools be different binaries.

Thanks, I’ll take a look.

I love obsidian for the same basic reason you do: it’s just a bunch of text files, so I can use terminal tools and write programs to do stuff with them.

So far I mostly use LLMs to write the tools themselves, but not actually edit the notes. Maybe I can steal some of your ideas!

I'd love to learn more about this. What resources/books/articles/code can I look at to understand this more? Or, if you have some time, would you mind expanding on it?

The parts I'm specifically interested in: 1. What the 300 line pool and allocator look like 2. What this means: "BTW the for-case can simply be supported by setting a pool/global boolean and using that to decide how to wait for a new task (during the paralle for the boolean will be true, otherwise do sleeps with mutexes in the worst case for energy saving)"

Thank you!

In reality what happens is that software which has at any point cared about being portable doesn't use them.

I don't think this generalization is actually true. Fast portable software compiles conditionally based on the target platform, picking the fast platform-specific intrinsic, and falls back to a slow but guaranteed portable software implementation. This pattern is widespread in numerical linear algebra, media codecs, data compressors, encryption, graphics, etc.

Last weekend I’ve made a simple CLI tool for myself to help me manage my notes it parses ~/.notes into a list of notes, then builds a tag index mapping strings to references into that list. Straightforward, right? Not in Rust. The borrow checker blocks you the moment you try to add a new note while also holding references to the existing ones. Mutability and borrowing collide, lifetimes show up, and suddenly you’re restructuring your code around the compiler instead of the actual problem.

I'd love to see the actual code here! When I imagine the Rust code for this, I don't really foresee complicated borrow-checker or reference issues. I imagine something like

  struct Note {
    filename: String,
    // maybe: contents: String
  }

  // newtype for indices into `notes`
  struct NoteIdx(usize);

  struct Notes {
    notes: Vec<Note>,
    tag_refs: HashMap<String, Vec<NoteIdx>>
  }
You store indices instead of pointers. This is very unlikely to be slower: both a usize index and a pointer are most likely 64 bits on your hardware; there's arguably one extra memory deref but because `notes` will probably be in cache I'd argue it's very unlikely you'll see a real-life performance difference.

It's not magic: you can still mess up the indices as you add and remove notes.

But it's safer: if you mess up the indices, you'll get an out-of-bounds error instead of writing to an unintended location in your process's memory.

Anyway, even if you don't care about safety, it's clear and easy to think about and reason about, and arguably easier to do printf debugging with: "this tag is mentioned in notes 3, 10 and 190, oh, let's print out what those ones are". That's better than reading raw pointers.

Maybe I'm missing something? This sort of task comes up all day every while writing Rust code. It's just a pretty normal pattern in the language. You don't store raw references for ordinary logic like this. You do need it when writing allocators, async runtimes, etc. Famously, async needs self-referential structs to store stack local state between calls to `.await`, and that's why the whole business with `Pin` exists.

Sureness is most certainly a word! It has been used by writers of the stature of Emerson ("the law holds with equal sureness for all right action") and Edith Wharton ("“The moment the reader loses faith in the author’s sureness of foot the chasm of improbability gapes.”)

It used to mean "certainty", as when T. H. Howard writes, "Uncertainty about our religious condition is quite as unsatisfactory as any doubt about our most sacred domestic relationships. Sureness is vital to peace, and the truly sanctified soul will live in the region of certainty."

But in more modern usage the word has a connotation slightly different from what the author of this library intends. Its meaning is closer to "assuredness": confidence matched with ability. For example, "Proust had an incredible sureness of touch in shedding this prophetic ray on his characters." (again from Edith Wharton).