by bobmarleybiceps · 1mo ago · 0 comments
On the other hand, I do some stuff with physics simulations and LLMs will spit out arrays like
static constexpr std::array<int, Q> cx{0, 1, 0, -1, 0, 1, -1, -1, 1};
static constexpr std::array<int, Q> cy{0, 0, 1, 0, -1, 1, 1, -1, -1};
static constexpr std::array<real_t, Q> w{ real_t(4) / 9, real_t(1) / 9, real_t(1) / 9, real_t(1) / 9, real_t(1) / 9, real_t(1) / 36, real_t(1) / 36, real_t(1) / 36, real_t(1) / 36};
static constexpr std::array<int, Q> opp{0, 3, 4, 1, 2, 7, 8, 5, 6};
and it's like ??? I know what these are for, but I have no clue if any of the numbers are right :-)
I was working on a ground-up implementation of a SPICE circuit simulator that would generate code to do realtime simulation of electrical circuits. Much of the work was derived from complex mathematics in a couple of papers that I was using as a guide, and from The Spice Manual (3rd edition) which serves as a guide/standard to the Spice language, including detailed mathematical formulae, expressed in standard mathematical notion (but no code) for most of the simulation operations.
When transcribing formulae into code by hand, I had gotten in the habit of providing references to page numbers and equation numbers in comments in the code, and "footnote" comments that provided URLs to the original material.
Imagine my surprise when Claude also provided correct comment references to pages and equation numbers when I asked it to write code to implement diode models.