Talk:Nth root: Difference between revisions

m
corrected a misspelling.
No edit summary
m (corrected a misspelling.)
 
(9 intermediate revisions by 5 users not shown)
Line 1:
== More effient implementation by computing the diffence first ==
Most implementations use x(k+1) = (x(k)*(n-1) + A/x(k)^n) / n, d = x(k+1)-x(k) instead of d = (A/x(k)^n - x(k) / n, x(k+1) = x(k) + d; This leads to inefficient algorithm and should be corrected (see implementation for for AWK, C and Octave). --[[User:Aschloegl]]
 
: There's no reason to believe that. At least in the C example, the bottleneck is likely the <code>pow_()</code> function, so calculating diff or x_k shouldn't make much of a difference. In fact, the C example compiled with <code>gcc -Ofast -msse</code> on my machine, looping over <code>root(x, 15)</code> a million times actually became marginally slower after your edit. I'll not revert the edit as the difference is small. You also forgot to change the return value. --[[User:Ledrug|Ledrug]] 12:57, 10 November 2012 (UTC)
 
==Comparison to Non-integer Exponentiation==
Okay, I get that this task calls for implementing a particular algorithm (convergence by successive approximation). However, it seems like it would be appropriate to describe (in comments perhaps) whether the language supports a more direct method of computing an nth root (such as raising a number to a fractional power: x ** (1/n) for the nth root of x).
Line 10 ⟶ 15:
 
==Maclaurin Series==
Nth root can be calculated using the maclaurinMaclaurin series of exp and ln like this
 
 
Line 67 ⟶ 72:
1.2599211
 
 
--[[User:Spekkio|Spekkio]] 12:05, 29 November 2011 (UTC)
Though, the higher value you want to calculate the Nth root of. The more iterations of the sums is needed to make an accurate computation.
 
--[[User:Spekkio|Spekkio]] 1214:0517, 29 November 2011 (UTC)
 
==task expansion==
 
I see no reason why this task can't be expanded to handle non-negative, non-positive numbers. ... Er, that is, cases of zero for the X.
 
This special case (while being excluded by the task's requirement), should be handled by all examples, I should think, as would any trivia solutions. -- [[User:Gerard Schildberger|Gerard Schildberger]] 23:38, 18 August 2012 (UTC)
 
 
==Formula hidden to most browsers by under-tested cosmetic edits at 20:07, 20 June 2016 ==
 
Under-tested cosmetic edits made to the task page at 20:07, 20 June 2016, including the injection of spaces around expressions in &lt;math&gt; tags, have left formula content completely invisible to all browsers which display the graphic file version of formulae rather than processing the MathML (this is, in fact, the majority of browsers). The MediaWiki processor does not currently expect such spaces, and generates syntactically ill-formed HTML if they are introduced. Other aspects of these cosmetic edits may further compound the problem. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 21:28, 22 September 2016 (UTC)
 
: Visibility now restored [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 06:38, 4 October 2016 (UTC)