Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
iiii90853yIt cannot be irrational.
A simple multiplication of two rationals cannot be irrational. -
@iiii Mathematically yes, but in computer terms maybe not because there may be float conversion deviations before the division step.
Of course, still rational because all valid floats are rational numbers (invalid ones like NaN are not numbers at all). -
from decimal import *
getcontext().prec = 1024
Decimal('507724375') / Decimal('173233600')
=
Decimal('2.9308654614347332157272030368242650386530095778186217916154833704316021834101467613673098059498850107600373137774658034007259561655475612121436026267421562560611798173102677540615677328185756111978276731534760000369443341245578225009466985619417942015867591506497584764156607032354000609581513055204071265620526272039604326181525985721014860858401603384101005809496541086717588273868348865347138199517876439674520416362645583766659585669292793084020651882775627822778029204496125462958686998365213214988316354333108588634075606579785907583748187418607013881833547302601804730721984649629171246224750856646747513184509240701572905025353049292977805691274671888132556270838913467133396754440247157595293291832531333413379390603208615418717846884207220770')
If you want to search the result. -
@iiii A computer can't even represent many rational numbers, at least not in float / double format - e.g. 0.1 has no float / double representation.
-
@Wisecrack I'm too lazy, but since you have the dev environmant, you could use autocorrelation to figure something out.
-
iiii90853y@Wisecrack is that the whole number or is it just a cut off version of it? If it is a whole number then it does not have to have a cycle at all.
-
@iiii not the whole number. I had to cut it off due to message limit.
Maybe it just has a very long period. -
iiii90853y@Wisecrack or just a very long number which has no repeatable parts but is actually finite.
-
@-red The drawback is that if the FFT window size is not an exact multiple of the periodicity, or you have a lot of periods inside the window, the peaks will get pretty smeared. Normally, you would ameliorate that with a window function that fits your purpose best, but in this application, I don't see that.
-
Hazarth94843yI got you @Wisecrack
the number is actually periodic
it outputs:
"2.930865"
after which follows:
"4614347332"
... <54 116 integers> ...
"7686915240"
and after that the number repeats ad infinitum, all 54 136 integers total again and again...
How I figured it out:
linux has a handy arbitrary precision calculator called "bc" I simply asked it to generate 10 000 000 decimals and output them into a file
then I ran "grep -o" for the first 10 decimals, slowly moving the start index of the 10 decimals (by hand, I had faith it wont take long) until grep started outputing hundreds of matches instead of one... that was the starting index of the repetition...
then I just found where the second index is using a normal file search and trimmed the rest of the file, leaving me with the result in form 2.NNNNN<PeriodicPart>"
this was pretty simple to figure out -
Hazarth94843yWe already knew this was a rational number, because it can be expressed as a fraction, and all fractions with rational numbers for numerator and denominator are rational, which also includes periodically repeating numbers. :)
-
@Hazarth Damn man. Thats a really long cycle.
Hazarth really did the math.
> all fractions with rational numbers for numerator and denominator are rational
I didn't. Now I do. Thanks. -
iiii90853y@Wisecrack that's a definition of a rational number though... A fraction of two integers
-
This is more halfbaked math but when I plug it into one of a set of related equations, it pretty closely aproximates a variable I was searching for (t) == (1/(sr/(w/54136))) ==
Decimal('5.340084048953385449189027765691947213714919139713905878477516322')
where
t=Decimal('5.340201810833926108682774794166836574793635505768627212143851211')
Which gives
at/(1/(sr/(w/54136)) =~ a = Decimal('108273.3876396796632222442854053938042079615872966434651096426673')
where a == Decimal('108271')
if i = 54136 then
((sr/(w/54136/t)) / ((1/a)+j))
Decimal('1.000000000118369230902978549229171921293090845615153285385238072')
Its pretty carefully balanced considering the magnitude change when we add +/- 1 to i.
1/(((sr/(w/54135/t)) / ((1/a)+j)))
Decimal('1.000018472219302915241431008270846731929917566549113496572522954')
(((sr/(w/54137/t)) / ((1/a)+j)))
Decimal('1.000018472114824794099943655231632930084307283675697380872259375' -
Also I want to thank Hazarth for doing the math, as well as iiii, red, and Fast-nop for their contributions.
Autocorrelations is something I have to try now.
Btw, "RIP AND TEAR" was not the answer. I got a C- for that one.
Next steps is to write a period checker, and see if period length can be used for calculating the factors of other such numbers. -
Avyy7503yJust wanted to add that python decimal may not be enough for yhis type of precision(or any floating point). Use a CAS (sagemath is free, mathematica is big bucks). Sage has its own internal representation of rationals, which is precise to whatever level I want
-
@iiii Computer can store irrational numbers, just not as float but a more complex structure. sageMath can store sqrt(2), pi, .. as the real values. He can also do some math with it, for example sqrt(2)**2==2. Just when you need to calculate it numerically, you have to set a finite limit on the amount of digits.
-
@happygimp0 that's symbolic computation. Not really representing the irrational, but the symbol and an AST of the computation.
-
Avyy7503y@RememberMe Yes. And that also implies that we can only store computable irrationals. We can't store pi, coz we do not have an expression/AST that results in pi. CAS are beautiful
-
@AvyChanna pi is computable I think? Iirc a computable number was one where a TM could calculate its Nth bit.
I meant, you can just store "pi" (the symbol) and do all sorts of useful stuff from easy stuff like pi/pi = 1 to symbolic integration, differentiation, infinite series, and theorem proving. You don't actually need an AST of pi for that. -
Avyy7503y@RememberMe I meant we cant store pi "EXACTLY". We can't store what we don't know. Ofcourse we have a veeery good approximation of it(upto millions of digits)
-
@AvyChanna well, philosophically, if you have a finite algorithm to compute the Nth digit, haven't you "stored" the number as a frozen computation? It's just referential transparency. (Of course, this is theoretical CS, who cares about runtime amirite)
Yes practically you'd still have to actually run it to compute the Nth digit, but if we're going to quibble about practicality we also have significant figures in every calculation (which makes infinite precision more or less useless), so *practically* could say we can store pi "exactly" :p -
@RememberMe Floats are also not really representing rational numbers. Not even integers. I don't see a difference to any irrational number you can store.
-
@happygimp0 All floats that represent numbers (i.e. not e.g. NaN) are rational numbers, but not all rational numbers have a float representation.
-
@Fast-Nop Yes (except inf and -inf), i know how floats work. My point was that floats also "not really" representing rational numbers, just like how CAS do "not really" have datatypes to represent irrational numbers. You still need specially designed software or hardware that uses conventions how floats are handled.
Related Rants
Can anyone see where this repeats predictably?
Decimal('507.724375') / Decimal('173.2336')
I set the precision to 500+ digits and I'm not seeing any repetitions at a glance.
If there isn't, this is my new favorite irrational number.
question
math
irrational numbers