Talk:Natural logarithm/Archive 2

From WikiProjectMed
Jump to navigation Jump to search

What exactly do we mean by "cubic convergence"?

For simplicity, I will assume here that x ≥ 1 and thus ln (x) ≥ 0. If we apply Halley's method#Cubic convergence to our situation (trying to calculate the natural logarithm of x), using f(y) = exp (y) - x as we do in Natural logarithm#High precision, then we get the following

for

.

Thus

.

To extend this to 0 < x ≤ 1, replace x by 1 / x and observe that the result can be returned to the same form.

After that one can replace x by x / exp (yn), getting

.

OK? JRSpriggs (talk) 14:52, 1 May 2018 (UTC)

It is also useful to notice that for x > 0,

and thus

.

Consequently,

,

that is, the iteration never overshoots. JRSpriggs (talk) 09:16, 2 May 2018 (UTC)

While

,

it may be more useful to know how close to the "root" ln (x) one has to be before the cubic convergence becomes effective. More on this later. JRSpriggs (talk) 09:30, 2 May 2018 (UTC)

I did some calculations and got

Since ln(x)-yn+1 is an odd function of ln(x)-yn, it should be possible to increase the exponent of the bound from 4 to 5. However, I doubt that the extra effort would be worthwhile since this does nothing to get rid of the cubic term. For that, we would need a better function in the iteration. JRSpriggs (talk) 21:41, 4 May 2018 (UTC)

Belatedly, I realized that the calculations I was doing were a round-about way of getting the Taylor series of a certain function

.

That made it a lot simpler. However, although I have reason to think that the coefficients will remain small numbers, the expression I have for the derivatives produces large positive and large negative numbers which mostly cancel. This means that it is still not easy, and so I cannot yet determine the error bound.

More terms can be determined from hyperbolic function#Taylor series expressions. JRSpriggs (talk) 02:27, 6 May 2018 (UTC)

The main cost of performing an iteration is calculating the exponential of yn. We can use the formula I gave in my first comment in this section to avoid doing the last exponential before comparing it to x to see whether it is close enough. Here is pseudo-code for the algorithm:

input x and tolerance.
verify that they are positive real numbers.
let y := 0.
let expy := 1.
begin loop:
let nexty = y + 2 ( (x - expy) / (x + expy) ).
let min := min (x, expy).
if ( 3 (x + expy) - 5 min ) | x - expy |3tolerance 6 (x + expy) min3, then:
let lnx := nexty.
output lnx.
stop.
end if.
let y := nexty.
let expy := exp ( y ) *** this is the expensive step which we are trying to avoid.
end loop.
end routine.

Note that this uses the theorem

to get around the fact that we do not yet know what ln (x) is. JRSpriggs (talk) 03:40, 6 May 2018 (UTC)

The test for exiting the loop is intended to achieve the same effect as:

but without having to calculate exp (yn+1) and without knowing ln (x). Can the test be simplified? Yes, if you are not too picky about getting it right. We could define another variable

let threshold := cube_root ( 12 tolerance )

and compare | x - expy | ≤ threshold min. Or we could use nexty as a substitute for ln (x), which would make the test | nexty - y | ≤ threshold. JRSpriggs (talk) 13:03, 7 May 2018 (UTC)

To get a general idea of how this technique (the iterative method, not the program) converges, I ran a test beginning with a distant initial guess y0. I got the following:

ln (x) - y0 = 4.0000000000
ln (x) - y1 = 2.0719448398
ln (x) - y2 = 5.193595899·10-1
ln (x) - y3 = 1.13675706·10-2
ln (x) - y4 = 1.224097816·10-7

Notice that at first it moves closer by a little less than 2 which is the limit on how far it can move in one iteration. Then after it comes within 1 of the correct value, the cubic convergence begins to take hold. JRSpriggs (talk) 04:20, 8 May 2018 (UTC)

An alternative iteration to get the natural logarithm

I discussed the current version of Natural logarithm#High precision in the previous section of talk, Talk:Natural logarithm#What exactly do we mean by "cubic convergence"?. Now, I would like to suggest an alternative. Thanks to the third order Householder's method, we could use

Advantages: It converges faster, moving upto 3 when far away (as opposed to 2 for the Halley's method) per iteration and having quintic (fifth power) convergence (usually the third Householder's method only gives quartic convergence, but this is a especially favorable situation) when close rather than the cubic convergence of the Halley's method. This may allow for fewer iterations of the method and thus fewer evaluations of the power series for the exponential.

Disadvantages: It is a change, and any change may cause confusion. It requires three more multiplications to compute the adjustment. It is slightly more complex than the previous method. Although, I have proved that the convergence is quintic, I do not have the coefficient yet. If it is too large, that might be a problem.

Do you think that we should change the section to use this new method? JRSpriggs (talk) 05:05, 9 May 2018 (UTC)

I don't think it's appropriate for this article. In fact, a whole lot of the stuff currently in the "Series" and "Continued fraction" sections should probably be pruned out, as well. This is not an article on numerical methods for computing logarithms. --Trovatore (talk) 09:46, 9 May 2018 (UTC)
In that case, can we create an article on numerical methods for computing logarithms and transfer that material to it? JRSpriggs (talk) 00:14, 10 May 2018 (UTC)
Hmm, is that a topic called out as such in the literature? Certainly numerical methods are an important area of study and can be covered in Wikipedia, but going into detail about the pluses and minuses of specific ways of computing a particular function feels a little "handbook-like" to me.
That said, I wouldn't object to it nearly as much in its own article. Just make sure all the methods are sourced (and specifically for computing logs). Also convergence estimates, caveats, etc, should have sources that specifically say this is what happens when you're computing logarithms. --Trovatore (talk) 00:42, 10 May 2018 (UTC)

For the iteration suggested above,

.

JRSpriggs (talk) 06:08, 10 May 2018 (UTC)

Assuming that errors in calculating exp (yn) and yn+1 from x and yn are negligible,

JRSpriggs (talk) 01:27, 17 May 2018 (UTC)

Section on origin of the term

I've just removed the section titled Origin of the term natural logarithm. There was a ton of WP:OR/WP:SYNTH in here. The one source listed (which I had to check an archived copy of) didn't seem to actually verify anything at all in here. At best, it was just some extra history capped off with a statement to the effect of: "and that's why it's called the natural logarithm". If anyone disagrees or thinks any of this could/should be salvaged, please feel free to comment. –Deacon Vorbis (carbon • videos) 13:45, 18 July 2019 (UTC)

Read above section "Why natural"? Also see History of logarithms and recall previous name Hyperbolic logarithm. Justification for removal is weak. — Rgdboer (talk) 21:46, 19 July 2019 (UTC)
I'm not sure why concerns about OR/SYNTH are weak, and reading the above section really only strengthens my concerns there. This looks like a reading of primary source material and making conjectures based on that (however plausible doesn't matter). If someone can find a good history source that can confirm any of this, then great, but otherwise, I don't really understand the resistance here. –Deacon Vorbis (carbon • videos) 22:16, 19 July 2019 (UTC)
In science the term natural philosophy is associated with perceptible phenomena. In mathematics it is area which forms the perceptible quantification of natural logarithm. Would you please consider the quotation from Tom Whiteside on History of logarithms. Your challenge of this origin of the descriptor natural perpetuates ignorance of the concept and its relation to hyperbolic angle. — Rgdboer (talk) 21:48, 20 July 2019 (UTC)
After reading this I am actually less convinced that "naturalness" of the log is related to hyperbolic area. —Kusma (t·c) 15:25, 21 July 2019 (UTC)
(Whoops, forgot to reply.) I don't understand; are you claiming that the use of "natural" in "natural logarithm" is related to its use in "natural philosophy" (which itself is really just an old term for "science"). If not, then what are you getting at? If so, do you have source(s) to back this up? This all seems to be getting away from the main issue, which is that any claims about the term's etymology should be (secondarily) sourced – not left to editors to speculate about. –Deacon Vorbis (carbon • videos) 21:24, 21 July 2019 (UTC)
The essential nature of area defining this function was acknowledged by Derek Thomas Whiteside (1961) "Patterns of mathematical thought in the later seventeenth century", Archive for History of Exact Sciences 1(3):179–388, § III.1 The logarithm as a type-function pp 214–231, see especially page 231. — Rgdboer (talk) 23:11, 21 July 2019 (UTC)
@Rgdboer: I don't have access to this source, can you quote the relevant portion(s)? –Deacon Vorbis (carbon • videos) 00:09, 22 July 2019 (UTC)
Deacon Vorbis, a quote is in our article History of logarithms. It seems to me to be about several concepts from analysis and geometry coming together and becoming the natural logarithm, but I don't see any justification to say that the naturalness is inherited from geometry instead of from analysis. We don't call them "hyperbolic logarithms" any more, so it seems to me we are de-emphasizing the relation to geometry these days. —Kusma (t·c) 10:31, 22 July 2019 (UTC)
Mmm, okay, and yeah, I managed to ... "find" ... a full copy, and there's really no discussion on why the term is appropriate, or who first used it, etc. So barring any other sources, I'm not sure there's anything to do here. –Deacon Vorbis (carbon • videos) 13:33, 22 July 2019 (UTC)
The section has been restored with citation from V. Frederick Rickey who explicates Euler's development of the subject. — Rgdboer (talk) 22:11, 26 July 2019 (UTC)
@Rgdboer: The source you cited merely says that Euler called it by "natural or hyperbolic", not any of rest of that, or why he chose the term "natural" (was that term already in use? did Euler coin it?). I'm sure that a brief mention of Euler in the history section would be fine, but not any of the big pile of OR that was the main concern. –Deacon Vorbis (carbon • videos) 22:44, 26 July 2019 (UTC)
"Big pile of OR" should be described as 270 years have passed since Euler: anything original on this topic is unlikely. — Rgdboer (talk) 22:53, 26 July 2019 (UTC)
@Rgdboer: Are you talking to me? I'm guessing so, but you didn't indent your reply (I've done so for you), or give an actor for should be described, so it's hard to be sure. Anyway, I'm not sure what else I can do here. Nowhere in the section was there really an explanation of the origin of the term natural logarithm, and what was there wasn't sourced, so I don't understand what you're looking for here. –Deacon Vorbis (carbon • videos) 00:58, 27 July 2019 (UTC)

e^-lnx

Should we not include the line:


e-lnx = 1/x

? — Preceding unsigned comment added by 2603:6011:3140:7400:B4A0:B8CE:398B:B46E (talk) 03:52, 12 March 2021 (UTC)