r/programming • • 3d ago

Inventing Your Own Math As A Computer Programmer

https://leetarxiv.substack.com/p/inventing-your-own-math-as-a-computer-programmer?r=2at73k&utm_campaign=post&utm_medium=web&showWelcomeOnShare=true
45 Upvotes

31 comments sorted by

72

u/vips7L 3d ago

Psychosismaxxxxing

8

u/bwainfweeze 2d ago

John Nash enters the chat.

1

u/dmc_2930 2d ago

Damnit take my upvote.

85

u/Dreadgoat 2d ago edited 2d ago

TIL most of this subreddit doesn't understand the elementary definition of math: It's a language. Just like all languages, you can make up arbitrary new components any time you want. It doesn't even matter if it's useful, thousands of people dabble in speaking Klingon, we enjoy doing this. Schools of math such as group theory were worthless for decades before applications were found, mathematicians just like shooting shit at the wall.

Computers run into issues with certain schools and edges of mathematics where arithmetic architecture that is ideal for 99.9% of cases becomes a burden. OP is attempting to invent, yes INVENT, not discover, some new made up bullshit that approximates "real/ discovered" math in such a way that anybody's regular CPU can easily perform weird calculations with reasonable accuracy, using simple C interfaces and established types.

According to OP, out of 10000 tests (discovered established "real" math) 9988 passed (using his invented operations) and declares this a successful venture. I'll let you decide the value of 99.88% accuracy.

It's probably not useful, and may never be, but it's a cool exercise. I can't think of any real world applications where this needs to be made so much more efficient. But this is the kind of stuff that somebody stumbles upon 20 years later and says "oh wow I'm glad some insane guy did this for me already, turns out we need it now"

31

u/NiIly00 2d ago

mathematicians just like shooting shit at the wall.

I always say: Mathematicians are so good at solving problems they keep running out of them so they start to find answers for problems we haven't even encountered yet.

6

u/DavidJCobb 2d ago

Just like all languages, you can make up arbitrary new components any time you want. It doesn't even matter if it's useful, thousands of people dabble in speaking Klingon, we enjoy doing this. Schools of math such as group theory were worthless for decades before applications were found

To offer another real-world example of the principle you're talking about: per Ross Williams (1993), the behavior behind CRCs is easier to understand if you view it as taking place in an alternate math ruleset, in which addition and subtraction are replaced with XOR operations, but multiplication and division are still built atop addition and subtraction in the same ways they used to be.

4

u/HasFiveVowels 2d ago

But this is more like writing a novel inspired by the lord of the rings movies, not realizing the movie was based on novels

3

u/favgotchunks 2d ago

There’s nothing wrong with that

2

u/HasFiveVowels 2d ago

No there’s not but you probably shouldn’t release it going "for the first time ever, you can read LOTR!"

2

u/ItzWarty 1d ago

And this stuff can be useful in different domains, think about for example different hardware representation of floating point, cryptography, automatic differentiation + a load of real-world geometry problems which tend to be solved in higher-dimensional spaces. Even in computer graphics there is interest in these kinds of things to improve efficiency, decrease compression error, or avoid singularity failure cases ('degeneracies').

It's niche for sure, but applied mathematics is a real part of modern programming.

1

u/sockpuppetzero 1h ago edited 1h ago

The title honestly is overselling what's going on; I'm not an expert on this exact topic, so maybe I'm overlooking some kind of subtlety the author is introducing, but this really looks like some bog-standard algebraic number theory stuff. As in, trying to implement certain specific, reasonably well-known number rings using C and floating point arithmetic, for no immediately obvious reason. That said, I would not rule out the possibility that the author already has an ulterior motive in mind, or could at least come up with one eventually.

So it's not entirely useless, and even if its expected direct utility is low, the expected indirect utility of this kind of thing can actually be pretty good, especially if you are interested in say, cryptography or coding theory.

Me, I am interested in things like lattices and continued fractions, so these topics are fairly closely related to some of my interests. I wish this author well!

1

u/Dreadgoat 1h ago

It's not oversold, it's just plainly stating what is happening.

The reason you feel it is oversold is because you have this grand idea in your mind of what "inventing math" means, when it's actually quite banal and easy.

Axiom: 1 o 1 = 4; 1 o 4 = 16; 4 o 4 = 64;
There I've invented some math. You can continue by induction to create a whole system around this 'o' operation. It took me 20 seconds. I'm not Euler.

1

u/sockpuppetzero 1h ago edited 1h ago

I don't think you don't get what I'm saying. I'm saying I've taken graduate-level algebra classes, and if I'm not mistaken, these exact number systems that the author is discussing are fairly standard examples, especially of principle ideal domains.

A favorite example of "reinvention" of mine is the one function known by more than two names, including "Dijkstra's fusc function" and "Stern's Diatomic Sequence".

Dijkstra was interested in the function purely because of its recursive form, and I'm pretty sure was oblivious to the fact he wasn't the first to invent/discover this function, let alone awareness of any of it's connections. Moritz Stern had some knowledge of this function, as well as the Calkin-Wilf tree. I couldn't tell you if Stern knew those things are actually intimately connected.

1

u/Dreadgoat 1h ago

That's a fair point, it's entirely possible that the "invention" here has been done before. Normally I'd say it's pretty likely given the sheer volume of shit-at-wall-shooting mathematicians do.

On the other hand maybe it's less likely because what OP is doing is fundamentally "bad math." It is an inaccurate representation of the complex number system it approximates. 99.88% accuracy, assuming that's even correct and not optimistic testing, is fine for an engineer but a disaster for a mathematician.

Either way, the point of what is being done here is less about creating something useful and more about the experience of figuring it out. I think everyone who is interested in math and complex engineering should try "inventing" their own math, even if what they create is useless or already exists in some obscure niche they don't know about.

6

u/Optimal-Savings-4505 3d ago

Haters gonna hate. Looks like a fine way to spend your time!

6

u/takanuva 3d ago

Discovering* your own math.

4

u/VictoryMotel 3d ago

You should get together with terrance howard, he invented his own new math too.

0

u/reParaoh 3d ago

Y tho

-21

u/DataBaeBee 3d ago

My weekend sideproject has been building a complex number unit. It’s like a cpu where you replace floating point with imaginary numbers of the form x² + ny². It's use case is fairy quantization (using complex numbers instead of ternary quantization) in AI, factorization and solving discrete logs.

12

u/dmc_2930 3d ago

In what world is x^2 + n*y^2 an imaginary number?

11

u/VictoryMotel 3d ago

The imaginary world

7

u/favgotchunks 3d ago

I haven’t checked it, but at a surface level it looks like it might be valid abstract algebra. Confusingly presented but still, not unheard of to “define an algebra”

4

u/HasFiveVowels 2d ago

It’d be a reasonable definition in something like Geometric Algebra. Looks like the sort of quadratic form you’d find there

1

u/dmc_2930 2d ago

That’s still not a complex number…….

4

u/HasFiveVowels 2d ago

It’s a basis by which you can define a complex number. It’s a "rose by any other name" situation. In this case, n would play the role of the imaginary unit.

That said, the author is over claiming and conflating ideas

3

u/dmc_2930 2d ago

So then n is just I and you’ve done nothing new other than force everything to be second order?

Yeah this is just AI slop.

0

u/HasFiveVowels 2d ago

Yea, I’m pretty sure it is. There’s more interesting constructions than just the squaring but it’s kind of confused and not really new

-1

u/dmc_2930 2d ago

If only integers can be “real numbers” then “imaginary numbers”‘aren’t orthogonal so nothing useful can be done with them until you add an extra imaginary factor

3

u/HasFiveVowels 2d ago

Integers are a proper subset of real numbers. Complex numbers are more about how they behave under multiplication than they are about the imaginary unit. It’s like having an interface. The machinery underneath can differ

1

u/Rest-That 2d ago

I guess op is off their meds

-9

u/TheBuildersBench 3d ago

Good 👍 👍 👍