Re: square number



"Ioannis" <morpheus@xxxxxxxxxxxx> wrote in message
news:1155679826.896855@xxxxxxxxxxx
<dcorbit@xxxxxxxxx> wrote in message
news:1155678816.656595.9750@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[snip]

Here is the solution to a related problem:
Given a number, find what number raised to its own power is equal to
that number.
So given 4, the answer is 2 and given 27 the answer is 3. But what if
you are given 5 or 32.123?

This is known to have a solution via Lambert's W function. The equation
x^x=y
is solvable as:
x=log(y)/W(log(y)).

Of course, then one requires an algorithm for the principal branch of W
with
good precision, but such algorithms exist and can be found with Google.

My program attached also solves the problem. It uses Schroeder's
methods to
solve x^x-y = 0

If you don't have Maple or Mathematica, it is not likely that you have
an
implementation of Lambert's W function handy. The code I supplied
works for
any C compiler. I see that Lambert's W function is included in the
GSL. So
a shortened solution would be easy to produce.

--
Ioannis


.



Relevant Pages

  • Re: Powers of 5
    ... This should give you the modified algorithm almost immediately. ... Courses with greater emphasis on programming have entered ... require the argument to be a power of 2. ...
    (sci.math)
  • Re: square number
    ... find what number raised to its own power is equal to ... then one requires an algorithm for the principal branch of W with ... but such algorithms exist and can be found with Google. ...
    (sci.math)
  • Re: Surrogate factoring mysteries resolved
    ... > Now combinations of factors are important, as the proper algorithm ... does the number of divisors increase in a cubic fashion? ... No one doubts that factoring is hard. ...
    (sci.math)
  • Re: Surrogate factoring mysteries resolved
    ... > Now combinations of factors are important, as the proper algorithm ... does the number of divisors increase in a cubic fashion? ... No one doubts that factoring is hard. ...
    (sci.crypt)
  • Re: Another way to do x^n
    ... \ raise float to positive integer power ... DUP 0= IF DROP FDROP 1e0 EXIT THEN ... FDUP F0= IF DROP FDROP 0e0 EXIT THEN ... Recursion unnecessarily obfuscates the algorithm. ...
    (comp.lang.forth)