News for hackers. Stuff that matters.
Re:Rational or Not? This Basic Math Question Took Decades to... by FartyMcFarter on Thursday January 09, 2025 @12:40PM (#42647956)
I find it quite interesting that pi+e and pi*e are not proven to be irrational (although it's proven that at least one of them is irrational [1]).

It would be mind-blowing if either of them were rational numbers, yet it's very hard to prove either way.

[1] https://math.stackexchange.com/a/159353

Re:Rational or Not? This Basic Math Question Took Decades to... by rokob on Thursday January 09, 2025 @01:57PM (#42648754)
I could believe pi*e rational but pi+e being rational would blow my mind.
Re:Rational or Not? This Basic Math Question Took Decades to... by sunshowers on Thursday January 09, 2025 @02:29PM (#42649031)
I would be shocked if either of them were proven to be rational.
Re:Rational or Not? This Basic Math Question Took Decades to... by programjames on Thursday January 09, 2025 @03:30PM (#42649562)
Well, e^pi - pi = 20, is rational.
Re:Rational or Not? This Basic Math Question Took Decades to... by hollerith on Thursday January 09, 2025 @03:33PM (#42649586)
It is not exactly 20.
Re:Rational or Not? This Basic Math Question Took Decades to... by toth on Thursday January 09, 2025 @04:33PM (#42650000)
Very nice, didn't know about that one!

In a similar vein, Ramanujan famously proved that e^(sqrt(67) pi) is an integer.

And obviously exp(i pi) is an integer as well, but that's less fun.

(Note: only one of the above claims is correct)

Re:Rational or Not? This Basic Math Question Took Decades to... by mvdtnz on Thursday January 09, 2025 @07:19PM (#42651222)
You didn't know that one because it's a lie. He's telling lies.
Re:Rational or Not? This Basic Math Question Took Decades to... by toth on Friday January 10, 2025 @04:25AM (#42654067)
Charitably it was a joke, as was my quip about `e^(sqrt(67) pi)`. It is a funnier joke without a disclaimer at the end, but unlike GP I couldn't bring myself to leave one out and potentially mislead some people...

What I meant was that I didn't know that `e^pi - pi` is another transcendental expression that is very close an integer. You might think this is just an uninteresting coincidence but there's some interesting mathematics around such "almost integers". Wikipedia has a quick overview [1]. I didn't realize it before, but they have GP's example and also the awesome `e + pi + e pi + e^pi + pi^e ~= 60`.

[1] https://en.wikipedia.org/wiki/Almost_integer

Re:Rational or Not? This Basic Math Question Took Decades to... by isaacfrond on Friday January 10, 2025 @04:10AM (#42653982)
The number you are looking for is e^(sqrt(163) pi). According to Wikipedia:

In a 1975 April Fool article in Scientific American magazine,[8] "Mathematical Games" columnist Martin Gardner made the hoax claim that the number was in fact an integer, and that the Indian mathematical genius Srinivasa Ramanujan had predicted it – hence its name.

It is not an integer of course.

Re:Rational or Not? This Basic Math Question Took Decades to... by toth on Friday January 10, 2025 @04:31AM (#42654102)
Actually `e^(sqrt(n) pi)` is very close to being an integer for a couple of different `n`s, including 67 and 163. For 163 it's much closer to an integer, but for 67 you get something you can easily check in double precision floats is close to an integer, so I thought it worked better as a joke answer :)

FYI, the reason you get these almost integers is related to the `n`s being Heegner numbers, see https://en.wikipedia.org/wiki/Heegner_number.

Re:Rational or Not? This Basic Math Question Took Decades to... by Someone on Friday January 10, 2025 @09:12AM (#42655700)
> The number you are looking for is e^(sqrt(163) pi) […] It is not an integer of course.

Of course? I’m not aware that we have some theorem other than “we computed it to lots of decimals, and it isn’t an integer” from which that follows.

Re:Rational or Not? This Basic Math Question Took Decades to... by less_less on Friday January 10, 2025 @12:09PM (#42657511)
It's not really "of course", and I don't think we have such a theorem in general. But in this case, I believe the fact that it's not an integer follows from the same theorem that says it's very close to an integer. See eg https://math.stackexchange.com/questions/4544/why-is-e-pi-sq...

Basically e^(sqrt(163)*pi) is the leading term in a Laurent series for an integer, and the other (non-integer) terms are really small but not zero.

Re:Rational or Not? This Basic Math Question Took Decades to... by nimih on Thursday January 09, 2025 @04:59PM (#42650223)
Do you have a citation for the rationality of e^pi - pi? I couldn't find anything alluding to anything close to that after some cursory googling, and, indeed, the OEIS sequence of the value's decimal expansion[1] doesn't have notes or references to such a fact (which you'd perhaps expect for a rational number, as it would eventually be repeating).

[1] https://oeis.org/A018938

Re:Rational or Not? This Basic Math Question Took Decades to... by chowells on Thursday January 09, 2025 @05:15PM (#42650380)
Re:Rational or Not? This Basic Math Question Took Decades to... by nimih on Thursday January 09, 2025 @05:28PM (#42650500)
Is the joke here that if you lie to people (on the Internet or otherwise), they’ll take it at face value for a little bit and then decide you’re either a moron or an asshole once they realize their mistake?
Re:Rational or Not? This Basic Math Question Took Decades to... by chowells on Thursday January 09, 2025 @05:30PM (#42650520)
Nah. I'd read it as there being an expectation that the audience already knew the joke and they were playing the favorites.
Re:Rational or Not? This Basic Math Question Took Decades to... by Izkata on Friday January 10, 2025 @07:07PM (#42661893)
Also that "black hat" character is consistently evil in every comic he's in.
Re:Rational or Not? This Basic Math Question Took Decades to... by c0redump on Friday January 10, 2025 @02:29AM (#42653472)
Wow, you just made my day with this! What a fantastic result! Beautiful.

Edit: looks like I swallowed the bait, hook like and sinker

Re:Rational or Not? This Basic Math Question Took Decades to... by chongli on Thursday January 09, 2025 @02:30PM (#42649042)
I mean you just have to get to the point where all of the trailing decimal places (bits) form a repeating pattern with finite period. But since there are infinitely many such patterns it becomes extremely hard to rule out without some mechanism of proof.
Re:Rational or Not? This Basic Math Question Took Decades to... by dvt on Thursday January 09, 2025 @06:15PM (#42650824)
I'm kind of in the opposite camp. If Schanuel's conjecture is true, then e^iπ = 0 would be the only non-trivial relation between e, π, and i over the complex numbers. And the fact that we already found it seems unlikely.
Re:Rational or Not? This Basic Math Question Took Decades to... by seanhunter on Friday January 10, 2025 @12:16AM (#42652736)
you mean e^(i pi)=-1, which is known as Euler's identity and is a specific case of Euler's formula

e^(i theta) = cos theta + i sin theta

It is a matter of definition in complex analysis that the formula is true, so since sin pi = 0 and cos pi = -1, if you set theta=pi you have e^(i pi)=-1

Re:Rational or Not? This Basic Math Question Took Decades to... by botanical76 on Friday January 10, 2025 @07:44AM (#42655126)
Thanks for ringing some bells. It's been a long time since I used that equation.
Re:Rational or Not? This Basic Math Question Took Decades to... by cbm-vic-20 on Thursday January 09, 2025 @01:30PM (#42648481)
Is the result of the addition or multiplication of an irrational number with any other real number not equal to it (and non-zero in the case of multiplication) always irrational? ex: pi + e, pi * e, but also sqrt(2) - 1 or sqrt(3) * 2.54 ?
Re:Rational or Not? This Basic Math Question Took Decades to... by AlotOfReading on Thursday January 09, 2025 @01:39PM (#42648565)
No, sqrt(5)*sqrt(16*5)=20. More trivially, there's always a number y such that z = x*y for a given irrational x. You can give similar examples for all the other basic operations.
Re:Rational or Not? This Basic Math Question Took Decades to... by LPisGood on Thursday January 09, 2025 @02:03PM (#42648806)
Take any irrational a where 1/a is also irrational. Then a * 1/a = 1.

Even moving from addition and multiplication to exponentials won’t save you: there are irrational numbers to irrational powers that are raational.

Re:Rational or Not? This Basic Math Question Took Decades to... by umanwizard on Thursday January 09, 2025 @02:56PM (#42649279)
> Take any irrational a where 1/a is also irrational.

In other words: any irrational at all

Re:Rational or Not? This Basic Math Question Took Decades to... by pfdietz on Thursday January 09, 2025 @02:40PM (#42649129)
The nonconstructive proof of that is simple and fun: either sqrt(2)^sqrt(2) or (sqrt(2)^sqrt(2))^sqrt(2) is just such an example.
Re:Rational or Not? This Basic Math Question Took Decades to... by aidenn0 on Thursday January 09, 2025 @01:33PM (#42648507)
Definitely not; consider the formula for calculating the log of any base given only the natural logarithm. That can result e.g. in two irrational numbers, the ratio of which are integers.
Re:Rational or Not? This Basic Math Question Took Decades to... by umanwizard on Thursday January 09, 2025 @02:24PM (#42648991)
pi and -pi are both irrational and their sum is zero.
Re:Rational or Not? This Basic Math Question Took Decades to... by ryandv on Thursday January 09, 2025 @04:53PM (#42650175)
There is an important distinction to be made here. Examples in this thread show cases of irrational numbers multiplied by or added to other irrational numbers producing real numbers, but in the special case of a rational number added to or multiplied by an irrational number, the result is always irrational.

Otherwise, supposing for instance that (n/m)x is rational for integers n, m, both non-zero, and irrational x, we can express (n/m)x as a ratio of two integers p, q, q non-zero: (n/m)x = p/q if and only if x = (mp)/(qn). Since integers are closed under multiplication, x is rational, against supposition; thus by contradiction (n/m)x is irrational for any rational r = (n/m), with integers n, m both non-zero. Similarly for the case of addition.

Re:Rational or Not? This Basic Math Question Took Decades to... by yen223 on Thursday January 09, 2025 @05:46PM (#42650640)
irrational number + rational number = irrational number [1]

irrational number + irrational number could be rational or irrational.

5 - sqrt(2) is irrational

sqrt(2) is irrational

Add them up you get 5, which is rational

[1] If it were rational, you will be able to construct a rational representation of the irrational number using this equation.

Re:Rational or Not? This Basic Math Question Took Decades to... by dhosek on Friday January 10, 2025 @11:53AM (#42657366)
To put the first equation more formally, we know that ℚ is closed under addition¹, so given k∊ℝ\ℚ, l∊ℚ then if k+l=m∊ℚ, then m-l=m+(-l)∊ℚ, but m-l=k which is not in ℚ so k+l∉ℚ.

⸻

1. For p,q∊ℚ, let p=a/b, q=c/d, a,b,c,d∊ℤ, then p+q=(ad+bc)/bd, but the products and sums of integers are integers, so p+q∊ℚ

Re:Rational or Not? This Basic Math Question Took Decades to... by vrighter on Friday January 10, 2025 @09:05AM (#42655654)
x - (x - floor(x)) == x truncated to an integer

when x is an irrational number > 1:

"x - floor(x)" is just the fractional part of x, so it's an irrational number which is not equal to x.

Subtracting the fractional part from the original leaves only the integer part, which is obviously rational.

Re:Rational or Not? This Basic Math Question Took Decades to... by tshaddox on Thursday January 09, 2025 @01:27PM (#42648456)
Out of curiosity, why would it be mind-blowing if either of them were a rational number?
Re:Rational or Not? This Basic Math Question Took Decades to... by charlieyu1 on Thursday January 09, 2025 @01:34PM (#42648518)
If pi+e=a/b then you can write one as a/b minus the other

Which is pretty insane because these two numbers are not supposed to be related

Re:Rational or Not? This Basic Math Question Took Decades to... by hn_throwaway_99 on Thursday January 09, 2025 @01:52PM (#42648691)
> Which is pretty insane because these two numbers are not supposed to be related

Not really, there is Euler's identity: https://en.m.wikipedia.org/wiki/Euler%27s_identity

Re:Rational or Not? This Basic Math Question Took Decades to... by sunshowers on Thursday January 09, 2025 @02:41PM (#42649149)
That one's "just" a special case of how complex numbers happen to work. I think the really cool relationship between e and pi is the fact that the Gaussian integral acts as a fixpoint/attractor when sampling and summing data from any distribution (this is the central limit theorem):

∫(−∞ to ∞) e^(-x²) dx = √π

I think the attractor property makes it a little more fundamental in some sense, whereas Euler's identity is "just" one special case of e^ix. The Gaussian is kind of the "lowest energy" or "highest entropy" state of randomness, which I think is really cool.

Re:Rational or Not? This Basic Math Question Took Decades to... by octachron on Thursday January 09, 2025 @04:08PM (#42649805)
This is only true for distributions with finite variance (and the edge case of distribution with slowly growing infinite variance).

And for a given variance, gaussian distributions are exactly the maximal entropy distribution.

Re:Rational or Not? This Basic Math Question Took Decades to... by pishpash on Thursday January 09, 2025 @04:52PM (#42650161)
e and pi are highly related, both pop out of periodic phenomenon.
Re:Rational or Not? This Basic Math Question Took Decades to... by Someone on Friday January 10, 2025 @09:17AM (#42655737)
> because these two numbers are not supposed to be related

Says who? They’re not known to be related in that way, but it’s not like nature set out to prevent such a thing, or that large parts of mathematics would break down if it happened to be the case.

Re:Rational or Not? This Basic Math Question Took Decades to... by gosub100 on Thursday January 09, 2025 @01:08PM (#42648257)
Re:Rational or Not? This Basic Math Question Took Decades to... by paulddraper on Thursday January 09, 2025 @09:22PM (#42651859)
> although it's proven that at least one of them is irrational

And not particular to e and pi. More generally, at least one of a+b and a*b must be irrational, if an and b are transcendental.