Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] Cool python script (Read 1110 times) previous topic - next topic
0 Members and 4 Guests are viewing this topic.

Re: [SOLVED] Cool python script

Reply #15

 Absolute perfection! Works exactly how it should 🎯 👍 Now there's a need just for a minimum input from user. Thank you 💯 🤩


Re: [SOLVED] Cool python script

Reply #16
 Hmm, it looks like the  script messes the d.

It doesn't give same results when i'm doing same calc on paper. Think those factorials aren't grouped in the way the formula intended.




edit: discovered while checking things that there's no error it's just that for large numbers python precision drops. So I got it, sorry.

Re: [SOLVED] Cool python script

Reply #17
I forgot how this script works, and I don't understand what each variable meant to represent.
can you give me the formula or explain each of these variables and what's their purpose, like  z, d, ems, ...


Re: [SOLVED] Cool python script

Reply #18
 It's ok the script but because large numbers precision drops. How can I increase its precision? I've verified it but needs to have higher precision.

Re: [SOLVED] Cool python script

Reply #19
After 15-17 digits python lose accuracy.

For example A(94,12)=94!/82!= 228.743.740.236.102.111.820.800   in gnome-calculator

  but in my script gives 94!/82!= 228.743.740.236.102.111.330.304   in the script

 It loses about 490.496

And because the script has not one but two places where divides huge numbers (depending what's used) things lose accuracy each time it calculates numbers exceeding 17 digits.

Re: [SOLVED] Cool python script

Reply #20

I forgot how this script works, and I don't understand what each variable meant to represent.
can you give me the formula or explain each of these variables and what's their purpose, like  z, d, ems, ...



You can check it out here

Re: [SOLVED] Cool python script

Reply #21
might be because
Code: [Select]
print("is 0.1+0.2 equal to 0.3")
print (0.1+0.2==0.3)
print("=================")
print("9999999999999999.0-9999999999999998.0=",9999999999999999.0-9999999999999998.0)
print ("================")
print ("what the hell??????")
#this mistake cause by binary system that defined by IEEE754
#you can read about it in (https://en.wikipedia.org/wiki/IEEE_754?wprov=sfla1)
or might not be

for example:
Code: [Select]
import math

result = math.factorial(94) / math.factorial(82)
print(result)
gives:
Code: [Select]
2.287437402361021e+23
that is equal to:
Code: [Select]
 228743740236102111330304
so you see there's no problem with code, but with python itself (or all PL in general)

this might come handy if you want to fix this: percition py

the question is, are you willing to rewrite the code in this library

Re: [SOLVED] Cool python script

Reply #22

Yeah, no code problem I realize after calculated by hand with gnome calculator. You need to choose the option 'fixed' from gnome calc to have the whole number and not cropped. Tried to make a 94^16 that gives about 231 slices and after trying to add slices results it gave some trillion in minus. When using the script in the lower order of magnitude range always it adds up exactly to T^S.

Re: [SOLVED] Cool python script

Reply #23
 
Also awk summation function when using big numbers has huge margin of error similar with python.
the question is, are you willing to rewrite the code in this library
I would wanna rewrite it if I would know how  :D  simply python rounds every number beyond 10^15 .

Also python tricked me cos at start I gave big credit those numbers, thought are perfection but those were rounded pretty nasty.

Re: [SOLVED] Cool python script

Reply #24
well, I got an amazing news for you.

I just remembered something.

Code: [Select]
import mpmath

# Set the desired precision
mpmath.mp.dps = 50

result = mpmath.factorial(94) / mpmath.factorial(82)
print(result)

Re: [SOLVED] Cool python script

Reply #25

 yupiii, I'm going to try an see how it performs  🥳 tnx a lot 🙏🏻

Re: [SOLVED] Cool python script

Reply #26

 Haha, just tested it and it works like  Swiss watch.  8) Tnx once again and a big round of applaud  👏🏻👏🏻👏🏻

Re: [SOLVED] Cool python script

Reply #27

 Had to choose precision, not 50 not 100 but no more no less than 1000 and now gives exact results what formula should give.

 All slices summed gives 🎯 94^16 🎯 mapped a 16 long pwd with a 94 search depth (without space char).

 With 100 precision still lost 22 out of 94^16