mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Miscellaneous Math (https://www.mersenneforum.org/forumdisplay.php?f=56)
-   -   Probability that n is a semi-prime or prime (https://www.mersenneforum.org/showthread.php?t=21946)

science_man_88 2017-01-18 23:39

[QUOTE=a1call;451190]It's a bit exaggerated to call the notion used by the rest (from mathematicians and programmers ) of the world "unusual".

[URL]https://en.wikipedia.org/wiki/Logarithm#Particular_bases[/URL]

It is arguable that the logarithm function predates the discovery of e as well as computers, so chances are that log, unspecific must have referred to base 10 originally by all.
Base 10 log is still quite useful in logarithmic scales and units.
[URL]https://en.wikipedia.org/wiki/Logarithmic_scale[/URL][/QUOTE]

the moment magnitude scale can be related to the log_(10^(3/2))(x) where x is energy just as easily based on the descriptions given. and for pH it could also relate to the log of x in base 1/10 in theory.

VBCurtis 2017-01-19 03:17

[QUOTE=a1call;451190]It's a bit exaggerated to call the notion used by the rest (from mathematicians and programmers ) of the world "highly unusual".
[/QUOTE]
You're in a mathematics forum, in a thread discussing the implied base of a usage of log in a mathematics formula. Dr Greathouse's statement is right on, in the context of this thread and this forum.

As a former physics major, I found it confusing during my graduate math studies that log was *never* disambiguated; a statement such as Dr Greathouse's would have cleared up much for me as I changed from science studies to mathematics. I assumed this formula was log_10 myself, years ago, only deciding otherwise by repeating the calculations of others using both bases to learn which was proper (and then doubting whether the other person had chosen the right base). So, his "highly unusual" is quite helpful in telling us to default to natural log *anywhere* in higher mathematics (say, above differential equations).

Dubslow 2017-01-19 06:00

[QUOTE=VBCurtis;451202]
As a former physics major, I found it confusing during my graduate math studies that log was *never* disambiguated; a statement such as Dr Greathouse's would have cleared up much for me as I changed from science studies to mathematics. I assumed this formula was log_10 myself, years ago, only deciding otherwise by repeating the calculations of others using both bases to learn which was proper (and then doubting whether the other person had chosen the right base). So, his "highly unusual" is quite helpful in telling us to default to natural log *anywhere* in higher mathematics (say, above differential equations).[/QUOTE]
As a physics major with an admitted strong bias to the mathematical bent, I was never really confused by what "log" meant. But maybe things are different since when you went to high school? Even in pre-calc (circa 2009 for me) it was pretty clear that "log" meant the natural.

VBCurtis 2017-01-19 16:28

I've taught pre-calculus at a US public university for the last 20 years, and every textbook we've used has defined log as log_10, and natural log as only ln. Our single-variable calculus texts likewise always use ln for natural log (Stewart, Thomas, and Larson are the texts I've taught out of for Calculus).

danaj 2017-01-19 16:53

My "highly unusual" comment was in regard to programming languages and math packages, where I gave a number of examples. All of them use "log" to refer to the natural log. It was countering the comment that "that's only usual to Pari/GP" which seems to be in error.

There is another disagreement about what the base assumption is in written notation, but let's not conflate the two.

Re number theory, It looks like Cohen's "Course in ..." book uses lg/ln, while Apostol (a common intro textbook) says on page 8 "...where log x is the natural logarithm of x" and then goes on to use log as the natural log throughout the text. I typically find log to mean natural log in number theory papers, but that is purely anecdotal. I don't believe I've ever seen it specifically mean base 10.

danaj 2017-01-19 21:00

[QUOTE=CRGreathouse;451141]I hope you do code it, because I think that more can be done than the simple code I linked to, and I find that I use what I wrote reasonably often.

I feel bad, because I often write "issemi(n)=bigomega(n)==2" in the OEIS, knowing that I don't use that code but not wanting to bloat the entry with a full version of my code. Of course there's not all that much that can be done in GP -- the most you have access to are the flags of factorint. It's much nicer with access to the PARI internals.[/QUOTE]

I haven't dug into the internals of Pari too much to speed these things up (though after the Atelier I may do more). What I see so far:

206.124 sec gp: sum(n=10^17,10^17+10^6,bigomega(n)==2)
29.116 sec gp: sum(n=10^17,10^17+10^6,issemi(n))
9.996 sec perl -Mntheory -E 'for (10**17..10**17+1e6){ $t++ if scalar(factor($_)) == 2; } say $t;'
2.052 sec perl -Mntheory -E 'for (10**17..10**17+1e6){ $t++ if is_semiprime($_); } say $t;'

I'm sure things get more interesting once into bignums, and I haven't written that. There's some optimization that can be made in other areas, for example uisprime() is over 5x slower than my code, which we may fix this year.That's probably most of the difference between our codes for issemiprime.

More important for Pari is the 20x difference in bigomega at this size.


All times are UTC. The time now is 23:22.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.