Re: Getting rid of ProductLog

• To: mathgroup at smc.vnet.net
• Subject: [mg49278] Re: Getting rid of ProductLog
• From: "Dana" <delouis at bellsouth.net>
• Date: Sun, 11 Jul 2004 02:16:12 -0400 (EDT)
• References: <ccisbq\$4de\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Here is my attempt using Excel vba.  You need to supply a good initial
guess.  Here, you enter a=3,c=4, and a guess of -1, I get...

Debug.Print MyFunction(3, 4, -1)
-3.98748338411597

and in Mathematica, I get the same answer:

{-c - ProductLog[(-a^(-c))*Log[a]]/Log[a]} /. {a -> 3, c -> 4.}
-3.9874833841159707

Function MyFunction(a, c, guess)
Dim b As Double
Dim LastGuess As Double
Dim Counter As Long

b = guess
LastGuess = b + 1 ' Just make it different

Do While LastGuess <> b And Counter <= 10
LastGuess = b
b = (c + a ^ b * (-1 + b * Log(a))) / (-1 + a ^ b * Log(a))
Counter = Counter + 1
Loop
MyFunction = b
End Function

Some functions will return an answer that alternates in the last digit.
Therefore, in some problems, the last guess will never equal the new
guess.(they will be different in the last digit).  Therefore, you need to
account for this.  I just limited the loops to 10.  Adjust to your own
situation.

HTH
Dana DeLouis

"Robert Hulme" <robert.hulme at gmail.com> wrote in message
news:ccisbq\$4de\$1 at smc.vnet.net...
> Hi,
>
>
> I'm not a mathematician, but rather a programmer - I'm trying to use
> Mathematica to rearrange a formula for me.
>
> I'm trying:
>
> Solve[a^b - b == c, b]
>
> Which gives me:
>
> Out[3]//TextForm=
>                          Log[a]
>             ProductLog[-(------)]
>                             c
>                            a
> {{b -> -c - ---------------------}}
>                    Log[a]
>
> The problem with this is that I need the solution to use normal
> 'primitive' (if thats the right word) math functions as I need the
> formula for a computer program.
>
> With ProductLog being an internal Mathematica function I cant
> therefore use this rearrangement.
>
> on me as I'm not a math major :0) or that au fait with Mathematica.
>
> If it helps both a and b are always positive.
>
> Many thanks
> -Rob
>

```

• Prev by Date: Re: How to plot the surface of revolution graphics
• Next by Date: Re: Normal distribtion
• Previous by thread: Re: Getting rid of ProductLog
• Next by thread: Re: Getting rid of ProductLog