Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux? |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
03-29-2019, 05:48 AM
|
#1
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545
|
Maths Issue
Is there a calculator that calculates with 4 digit exponents? All handhelds give 3 digit exponents. I'm in probabilities, and need the result of this in scientific notation;
P = [ 0.75^1715 x 0.25^1596 x 0.5^1419 ].
Now I can find the some root of the indices, divide this (bigger) number into 1, and express the answer in scientific notation, and square back up the result, and get away with current equipment. That seems to be the same in simple examples.
|
|
|
03-29-2019, 05:58 AM
|
#2
|
LQ Guru
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
|
Those are some seriously small numbers!
Galculator works out P to be 4.79464779337e-1603 but I would advise comparing that against another calculator or two (try some online ones, for example).
Edit: Recalculated value.
Last edited by hydrurga; 03-29-2019 at 05:54 PM.
|
|
|
03-29-2019, 06:34 AM
|
#3
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,252
|
https://apfloat.appspot.com/
probably you can try to download their applet too. Implementing it does not seem difficult (I made something like this for commodore 64).
|
|
|
03-29-2019, 08:49 AM
|
#4
|
Senior Member
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,466
|
I use bc on the command line for such things. You have to specify scale for how many decimals. But then you can calculate correctly with super small and super big numbers. I don't think it can do scientific notation, because it would mean it has to round them somehow. Wouldn't it be better to just multiply with some super big number?
Code:
echo "scale=10000000000000000000000000000000000000000000000000000000000000000000000000000;0.75^1715 * 0.25^1596 * 0.5^1419" | bc -l | less
|
|
|
03-29-2019, 11:41 AM
|
#5
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,954
|
I don't know of a particular calculator which does this, but please remember when multiplying exponent numbers of different bases that you can also write the problem with the following considerations: - 0.75 = 0.25 * 3
- 0.5 = 0.25 * 2
- 0.75^1715 = 3^1715 x 0.25^1715
- 0.5^1419 = 2^1419 x 0.25^1419
- Result becomes: 3^1715 x 2^1419 x (0.25^1715 x 0.25^1596 x 0.25^1419)
- Add the common exponents and it becomes: 3^1715 x 2^1419 x 0.25^4730
I'm sure there are other manipulations possible to make the problem easier. I'm not math genius, but do recall that a great deal of the discipline is to be capable of converting things in manners similar to this where it makes the problem more fundamental to solve.
|
|
|
03-29-2019, 04:27 PM
|
#6
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545
Original Poster
|
Quote:
Originally Posted by hydrurga
Those are some seriously small numbers!
Galculator works out P to be 2.14001446e-2991 but I would advise comparing that against another calculator or two (try some online ones, for example).
|
Yes, and thanks for the reply. When you calculate Mendelian probabilities for retaining traits in a distributed population, I came up with those figures. I don't have galculator. Can you try 1/(2.14001446e-2991) to give me the format I was using? Is it anywhere near the 4.40 x 10^1604 I came up with? Also is 2.14001446e-2991 = 2.14001446 x 10^-2991?
@pan64:Thanks, I will go for that app tomorrow
Gutform: Thank you, but if bc does not do scientific notation, it's dead in the water for me. I'm not going to count hundreds of zeroes!
@rtmistler: Very interesting. I hadn't thought of manipulating that way. But I need scientific notation to dovetail with the rest of my figures, because probabilities are multiplied by each other, and it's important to have scientific notation to add the indices. I'm no great mathematician either. I actually did a lot of manipulation to simplify things this far.
|
|
|
03-29-2019, 06:02 PM
|
#7
|
LQ Guru
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
|
Quote:
Originally Posted by business_kid
Yes, and thanks for the reply. When you calculate Mendelian probabilities for retaining traits in a distributed population, I came up with those figures. I don't have galculator. Can you try 1/(2.14001446e-2991) to give me the format I was using? Is it anywhere near the 4.40 x 10^1604 I came up with? Also is 2.14001446e-2991 = 2.14001446 x 10^-2991?
|
Oops, I went to confirm the galculator result with speedcrunch and found that somehow I had calculated it wrongly. The correct answer, with increased accuracy provided by speedcrunch) is:
4.79464779337093780339e-1603
1 divided by the above is 2.08565893282629910515e+1602.
Yes, e is indeed that.
I would recommend speedcrunch to you as it is easy to paste formulae into it.
|
|
|
03-30-2019, 07:51 AM
|
#8
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545
Original Poster
|
Thanks, Hydruga.
That figure of 2.08565893282629910515e+1602 looks like my number of zeroes was fairly close. Scientific notation is corrected to 2 decimal places, so the string of decimals while impressive, is lost in the editing.Engineering notation retains them until they get to the engineer, who decides how precise he's going to be :-/.
It seems like I was in the ballpark, but squared the figures part of the answer. Perhaps I infringed BODMAS. I don't see where. What I did was to calculate the slightly less improbable
Code:
0.75^1714 x 0.25^1596 x 0.5^1418
= (0.75^852)^2 x (0.25^798)^2 x (0.35^709)^2 # Dividing into 1
= (2.804e108)^2 x (2.778e480)^2 x (2.693e213)^2 # Now squaring up
= 7.862e216 x 7.717e960 x7.252e426 # And multiplying out
= 4.40e1604
Now the interesting thing is that 2 digits of that 'e1604' came from the multiplication of 7, as 7^3 = 343. I wonder is that where a difference arose? That I in fact did the wrong sum? But doing that surely would have given me a smaller answer.
|
|
|
03-30-2019, 08:34 AM
|
#9
|
LQ Guru
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
|
Observations:
. 1714/2 is 857, not 852.
. You changed the 0.5 on the first line to 0.35 on the second line.
. 1/(0.75^852) is 2.804e+106, not 2.804e+108
I still recommend speedcrunch. Less chance of making mistakes on individual lines if it does all the donkey work for you. However, I still advise, because of the nature of the numbers involved, using two separate calculators to confirm each other's results.
|
|
|
03-30-2019, 09:22 AM
|
#10
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545
Original Poster
|
857 is correct, and that mistake is real.
The 0.35 is only in translation to the browser -sorry about that. The calculations carry 0.5.
Multiplying through gives me 7.81e1601, but although I only need an estimate, I realise I am no longer bound by dodges and wheezes. I tried slackrepo for speedcrunch, but it made an unwanted directory as usual and then puked. I'll resort to Mint and sort this out. I need the capability to sort these thing out better than I have, and the great thing about Open Source is that it comes free.
|
|
|
03-31-2019, 11:33 AM
|
#11
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,252
|
http://www.isthe.com/chongo/tech/com...lc-whatis.html
I downloaded/compiled and finally executed:
Code:
0.75^1715 * 0.25^1596 * 0.5^1419 * 10^1600
~0.00479464779337093780
but using log (actually any logarithmic functions may help) - and there is no need to use special tools.
Code:
log (0.75^1715 * 0.25^1596 * 0.5^1419) = log (0.75)×1715 + log(0.25)×1596 + log(0.5)×1419 = −1602.31924329
result: 10^−1602.31924329 = 10^-1600 * 0.004794648
sorry these are the original numbers, you need to adjust if you have other/different numbers.
Last edited by pan64; 03-31-2019 at 11:35 AM.
|
|
|
04-02-2019, 05:07 AM
|
#12
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545
Original Poster
|
Getting somewhere finally.
I installed speedcrunch and galculator in Mint, and worked out the various expressions. 2 of them were straightforward. The (1/0.75)^857 x (1/0.75)^858, when bracketed that way behaved also, but speedcrunch can handle 4 bit exponents and even 5 bit ones
@pan64: that looks impressive. Where did the 10^1600 come from?
By restating things differently, I could make life easy
P = 0.75^1715 x 0.25^1596 x 0.51^419.. Now, without any Math really we can cheat on dividing into 1
P = 1 in (1.333^1715 x 4^1596 x 2^1419)
= 1.8618e214 x 7.7222e960 x 1.4506e427 = 2.0855e1602
There is a variation of this Mendelian probability thing that actually generates 5 bit exponents, and to it's credit, speedcrunch handles them flying.
|
|
|
04-02-2019, 05:39 AM
|
#13
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,252
|
you can get it based on that logarithmic calculation but actually I just tried to calculate the following:
Code:
1/P = 0.75^-1715 * 0.25^-1596 * 0.5^-1419
Interestingly bc could handle it too and
Code:
echo '0.75^-1715 * 0.25^-1596 * 0.5^-1419' | bc | wc -c
1650
can give you a good starting point.
(I think you were talking about 4 and 5 digit exponents - instead of bits)
Last edited by pan64; 04-02-2019 at 05:42 AM.
|
|
|
04-05-2019, 11:57 AM
|
#14
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545
Original Poster
|
Quote:
Originally Posted by pan64
(I think you were talking about 4 and 5 digit exponents - instead of bits)
|
Yes, of course 
|
|
|
05-02-2019, 10:13 AM
|
#15
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,545
Original Poster
|
Resurrecting this thread briefly to correct Mathematical error, in case anyone uses my math as a statistics lesson. I'm doing Mendelian probabilities, once something has acquired a trait, what are the chances of retaining it for a given period. I was using the form
Code:
P = 1 in (1.333^1715 x 4^1596 x 2^1419)
but that's wrong. The 'x' signs marked are wrong as these traits are not interdependent. They should be added, not moltiplied. So the equation becomes
Code:
P = 1 in (1.333^1715 + 4^1596 + 2^1419)
, and here, we get another surprise, best observed once you convert to scientific notation.
Code:
= 1.2126e214 + 7.7222e960 + 1.4506e427
When you right justify those numbers, e214 & e427 appear way down the decimal places of e960; and as scientific notation is corrected to 2 places, They disappear without trace  So the answer is 7.72e960.
|
|
|
All times are GMT -5. The time now is 09:37 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|