Re: FindRoot, suppressing complex interval-numbers

• To: mathgroup at smc.vnet.net
• Subject: [mg70923] Re: FindRoot, suppressing complex interval-numbers
• From: "dimitris" <dimmechan at yahoo.com>
• Date: Wed, 1 Nov 2006 03:56:39 -0500 (EST)
• References: <ei4lgf\$dgg\$1@smc.vnet.net>

```I don't see any point to your example.
Sin[x]+2=0 does not have any real roots.

Anyway

xs = {};
Block[{Message}, FindRoot[Sin[x] + 2, {x, 1.656*10^8, 1.653*10^8,
1.658*10^8}, EvaluationMonitor :> AppendTo[xs, x]]]
{x -> 1.6560000109316254*^8}

Cases[xs, _Complex]
{}

FindRoot works with Complex Numbers if you tell it to do so.

Copy/Paste in a notebook and execute the following cell to see more

FrontEndExecute[{HelpBrowserLookup["MainBook", "3.9.6", "6.7"]}]

Here are also two very informative links for FindRoot within this forum

Regards
Dimitris

Paul wrote:
> Hello,
> I have the following problem:
> Take the simple example
>
> FindRoot[Sin[x] +2, {x, 1.656 10^8, 1.653 10^8, 1.658 10^8},
> EvaluationMonitor :> AppendTo[xs, x]]
>
> In the Help we can read: "FindRoot[lhs==rhs, {x, a, a_min, a_max}]
> searches for a solution, stopping the search if x ever gets outside the
> range a_min to a_max. "
>
> But when I display xs I can see, that there are also two complex
> numbers used.
>
> This is a problem if I use a function (in my case a compiled one)
> inside FindRoot, which only accepts real numbers.
>
> So how can I suppress the using of complex numbers in FindRoot?
>
> Best regards,
> Paul
>
> (Mathematica 5.2)

```

• Prev by Date: Re: Curiosity concerning transformation rules for List
• Next by Date: Re: RE: Labelled ticks at the origin
• Previous by thread: Re: FindRoot, suppressing complex interval-numbers