Re: FindInstance does not abort with TimeConstrained

• To: mathgroup at smc.vnet.net
• Subject: [mg115458] Re: FindInstance does not abort with TimeConstrained
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Tue, 11 Jan 2011 19:21:22 -0500 (EST)

```leongz wrote:
> I am trying to find a solution to a set of three equations in three
> variables using FindInstance. Since I would like the computation to
> abort when it is taking too long, I wrapped it in TimeConstrained.
> However, the computation fails to abort, and even pressing Alt-. does
> not help. Appreciate any help. Thanks.
>
> My code is as follows, on Mathematica 8.
>
> eqnA = -0.41593500000000005*(1 - t)*(1 - u)*(1 - v) -
>   0.5155109999999999*t*(1 - u)*(1 - v) - 0.415706*(1 - t)*u*(1 - v) -
>   0.5152300000000001*t*u*(1 - v) +
>   0.20544400000000002*(1 - t)*(1 - u)*v +
>   0.30929599999999996*t*(1 - u)*v + 0.20519199999999999*(1 - t)*u*v +
>   0.30898500000000007*t*u*v
> eqnB = -0.08238600000000001*(1 - t)*(1 - u)*(1 - v) +
>   0.11608500000000001*t*(1 - u)*(1 - v) -
>   0.082311*(1 - t)*u*(1 - v) + 0.116053*t*u*(1 - v) +
>   0.15861400000000003*(1 - t)*(1 - u)*v +
>   0.5001389999999999*t*(1 - u)*v + 0.15848999999999996*(1 - t)*u*v +
>   0.49979000000000007*t*u*v
> eqnC = 0.12412599999999999*(1 - t)*(1 - u)*(1 - v) +
>   0.160255*t*(1 - u)*(1 - v) + 0.043126*(1 - t)*u*(1 - v) +
>   0.097819*t*u*(1 - v) + 0.404011*(1 - t)*(1 - u)*v +
>   0.5547869999999999*t*(1 - u)*v + 0.308304*(1 - t)*u*v +
>   0.47778400000000004*t*u*v
>
> eqnA = Chop[FullSimplify[eqnA], 0.0001]
> eqnB = Chop[FullSimplify[eqnB], 0.0001]
> eqnC = Chop[FullSimplify[eqnC], 0.0001]
>
> TimeConstrained[
>  FindInstance[{eqnA == 0, eqnB == 0, eqnC == 0, 0 <= t <= 1,
>    0 <= u <= 1, 0 <= v <= 1}, {t, u, v}, Reals]
>  , 1]

I cannot say why it fails to abort (might be a bug). You could use
FindMinimum or NMinimize instead, if all you require is a high
probability that no such root exists.

In[11]:= FindMinimum[{eqnA^2 + eqnB^2 + eqnC^2, 0 <= t <= 1,
0 <= u <= 1, 0 <= v <= 1}, t, u, v]
Out[11]= {0.0432204, {t -> 4.7235*10^-7, u -> 0.999999,
v -> 0.518692}}

In[13]:= NMinimize[{eqnA^2 + eqnB^2 + eqnC^2, 0 <= t <= 1,
0 <= u <= 1, 0 <= v <= 1}, {t, u, v}]
Out[13]= {0.0432204, {t -> 0., u -> 1., v -> 0.518695}}

An Interval computation proves there is no such root.

In[17]:= eqnA^2 + eqnB^2 + eqnC^2 /. {t -> Interval[{0, 1}],
u -> Interval[{0, 1}], v -> Interval[{0, 1}]}
Out[17]= Interval[{0.00080764, 0.845157}]

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: Turning Derivative into Function (Newbie Question)
• Next by Date: Re: FittedModel Objects... How does Mathematica do it?
• Previous by thread: Re: FindInstance does not abort with TimeConstrained
• Next by thread: Re: FindInstance does not abort with TimeConstrained