       Re: Solving an equation

• To: mathgroup at smc.vnet.net
• Subject: [mg51418] Re: Solving an equation
• From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
• Date: Sat, 16 Oct 2004 04:21:16 -0400 (EDT)
• References: <cklle4\$eqe\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```jujio77 at yahoo.com (Scott) wrote:
> I have an equation, Gamma[a+I b] = some complex number.  I need to
> solve this equation for a and b.

Typically, there will be infinitely many solutions. See below.

> I can write a+I b as z, but it can't
> be solved through NSolve.  What I have been doing is a double do loop
> for a and b and getting some number.  Then I compare this to the
> number I have.  Then I narrow down my possibilities for a and b, and
> go through the process again.  Does anyone know of a better way to do
> this problem?  Is there a way to have Mathematica compare each result
> of the do loop to a given value, and given certain conditions spit out
> an answer for a and b?

Certainly look at the response already given by Daniel Lichtblau, but let
me mention a very different approach which might be of use. Some time ago,
I developed an approximation for the inverse (principal branch) of the real
gamma function; see "Inverse Gamma Function" at
<http://mathforum.org/discuss/sci.math/a/m/367123/367124>. [At the time I
wrote that, I was unaware that Daniel had previously suggested something
using my approximation in the complex domain, but it works nicely!

The main "adaptation" I've made to my previous approximation is to allow
different braches of the logarithm to be used, since we're now working with
complex numbers and multiple solutions. AIG stands for
ApproximateInverseGamma.

L[z_, n_] := Log[z/Sqrt[2*Pi]] + 2*n*Pi*I;
AIG[z_, n_] := L[z, n]/ProductLog[L[z, n]/E] + 1/2

For our first examples, let's use the same value, 3 + 5*I, used by Daniel

In:= N[AIG[3 + 5*I, 0]]
Out= 4.040766662437202 + 0.809458889448528*I

In:= Gamma[%]
Out= 2.9542538687291082 + 4.952066867619615*I

To get this solution far more precisely

In:= FindRoot[Gamma[z] == 3 + 5*I, {z, 4}]
Out= {z -> 4.048806909342241 + 0.8061219366736553*I}

but, _considering its simplicity_, AIG works reasonably well here.

Note that 4.04... + 0.809...*I is not an approximation of one of the two
solutions mentioned by Daniel. To get an approximation of one of those, we
use a different branch:

In:= N[AIG[3 + 5*I, 1]]
Out= 5.244221150676627 + 4.373221814339161*I

The other solution which Daniel gave apparently cannot be approximated by
AIG. Nonetheless, AIG provides a very easy way to approximate as many
solutions as desired by using different branches. For example,

In:= Table[N[AIG[3 + 5*I, n]], {n, -5, 5}]
Out=
{8.569173560584497 - 12.901034605395182*I,
7.78702834003813 - 10.821866222844191*I,
6.934032296216477 - 8.612108708227566*I,
5.976814285932365 - 6.197862806430168*I,
4.850615201546351 - 3.3750113310836416*I,
4.040766662437202 + 0.809458889448528*I,
5.244221150676627 + 4.373221814339161*I,
6.305341094465263 + 7.019856094350459*I,
7.223222083387802 + 9.354604278933351*I,
8.05025152253416 + 11.515933830777435*I,
8.813678677993034 + 13.561294899894799*I}

In:= Gamma[%]
Out=
{3.0072272893524876 + 4.9857740150544645*I,
3.0078603511604793 + 4.983133706384024*I,
3.008514748161956 + 4.979089858939104*I,
3.0087772161344706 + 4.972015650130263*I,
3.005054077852697 + 4.956321056315101*I,
2.9542538687291082 + 4.952066867619615*I,
2.964000082914953 + 4.989287532490715*I,
2.9736755655173486 + 4.995940237826113*I,
2.9790047897469507 + 4.998218781373197*I,
2.982384214170453 + 4.999269332306986*I,
2.9847360144047173 + 4.999834250625654*I}

Warning: This response was written without much thought. There may be
significant drawbacks to using AIG besides those indicated above.

Two other examples are given below my signature.

David Cantrell

--------------------

In:= Table[N[AIG[-1000 + 500*I, n]], {n, -5, 5}]
Out=
{10.103501062631734 - 11.759987470562999*I,
9.408940901896164 - 9.611831291928395*I,
8.688014667678077 - 7.3105338016372166*I,
7.96307707563004 - 4.774416610794671*I,
7.359670522007456 - 1.86061579553127*I,
7.303476737078219 + 1.3916310116941213*I,
7.860358064200312 + 4.372213017556774*I,
8.580151565437184 + 6.953715688390507*I,
9.30403553110932 + 9.283247761845434*I,
10.002805023824852 + 11.450602602247157*I,
10.673157495331035 + 13.504122688835286*I}
In:= Gamma[%]
Out=
{-997.2020455370163 + 501.2529882211875*I,
-996.6745283937655 + 501.2448117163233*I,
-995.9084815611002 + 501.10356272765165*I,
-994.7820367943481 + 500.5422207949927*I,
-993.6010090005602 + 498.70204334626004*I,
-994.7397151088763 + 495.88073677360353*I,
-997.0568231220326 + 495.4391448543616*I,
-998.3076913751443 + 495.97846657249335*I,
-998.9362942218514 + 496.52193170456474*I,
-999.2856828595261 + 496.9546427379604*I,
-999.4984812216452 + 497.2926327205642*I}

In:= Table[N[AIG[1/10 - I/100, n]], {n, -5, 5}]
Out=
{7.415124675510394 - 13.763230671478823*I,
6.581440974084747 - 11.745953506345964*I,
5.656159764730283 - 9.62586568815651*I,
4.584178930684972 - 7.360386847096441*I,
3.2175773919763313 - 4.868560486894651*I,
0.8612595008894053 - 2.2335248837759987*I,
3.165306832522787 + 4.784429834864226*I,
4.546634252963682 + 7.2853914707074425*I,
5.624821510167048 + 9.556522209402686*I,
6.5536846870598895 + 11.680437088713305*I,
7.389767664831733 + 13.700531235115555*I}
In:= Gamma[%]
Out=
{0.09985412458625637 - 0.010229263731083432*I,
0.09982683837834178 - 0.010264829400209013*I,
0.0997856659169176 - 0.010317687391232877*I,
0.09971559657048247 - 0.010407682128041808*I,
0.09956788845157781 - 0.010613474995339423*I,
0.09949551308490184 - 0.011799689100020628*I,
0.09969297553821639 - 0.00930046867734496*I,
0.09979975412801753 - 0.009539584065042078*I,
0.09985161429417513 - 0.009643757588497417*I,
0.09988195063236968 - 0.009704591748427947*I,
0.0999018902264989 - 0.00974531144339588*I}

```

• Prev by Date: Re: Re: Sorting a list of pairs on the second elements
• Next by Date: Re: Re: Factor 2 error in Inverse Laplace Transform
• Previous by thread: Re: Solving an equation
• Next by thread: Re: Solving an equation