       Re: Solving an equation

• To: mathgroup at smc.vnet.net
• Subject: [mg51363] Re: [mg51299] Solving an equation
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Fri, 15 Oct 2004 02:46:24 -0400 (EDT)
• References: <200410141035.GAA14785@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Scott wrote:
> I have an equation, Gamma[a+I b] = some complex number.  I need to
> solve this equation for a and b.  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?
>
> Hope that makes sense.
>

I'm not sure what might be the best way to do this, but one workable
approach is to treat it as an optimization. Say your complex number is
3+5*I. Belwo we find roots near 1-2*I and 5+4*I respectively.

In:= FindMinimum[Abs[Gamma[a+I*b]-(3+5*I)], {a,1}, {b,-2}]

FindMinimum::lstol:
The line search decreased the step size to within tolerance specified by
AccuracyGoal and PrecisionGoal but was unable to find a sufficient
decrease in the function.  You may need more than MachinePrecision
digits of working precision to meet these tolerances.

-8
Out= {2.39838 10  , {a -> 0.0910323, b -> -0.133628}}

In:= FindMinimum[Abs[Gamma[a+I*b]-(3+5*I)], {a,5}, {b,4}]

FindMinimum::lstol:
The line search decreased the step size to within tolerance specified by
AccuracyGoal and PrecisionGoal but was unable to find a sufficient
decrease in the function.  You may need more than MachinePrecision
digits of working precision to meet these tolerances.

-7
Out= {1.10535 10  , {a -> 5.24561, b -> 4.37032}}

If you like you can use a root finder instead, or in conjunction with
this. I tend to prefer the second approach, using it as a polishing
step, because it does not always perform well without a good initial
point. Also, as the functions are not analytic, we should either provide
a gradient or use a secant method by specifying two initial values per
argument.

In:= FindRoot[eqns, {a,5.24,5.25}, {b,4.3,4.4},
WorkingPrecision->20, AccuracyGoal->20, PrecisionGoal->20]

Out= {a -> 5.2456145798271348496, b -> 4.3703225075594339402}

We could instead have requested higher precision/accuracy in FindMinimum
but that is slower and also, to judge from residuals, not quite as accurate.

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: Scale Values on Plot[]
• Next by Date: Re: Re: argMax
• Previous by thread: Re: Solving an equation
• Next by thread: Re: Solving an equation