Re: FindInstance does not abort with TimeConstrained
- To: mathgroup at smc.vnet.net
- Subject: [mg115455] Re: FindInstance does not abort with TimeConstrained
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 11 Jan 2011 19:20:48 -0500 (EST)
eqnA = Rationalize[ -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, 0] // Simplify; eqnB = Rationalize[ -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, 0] // Simplify; eqnC = Rationalize[ 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, 0] // Simplify; Reduce[{eqnA == 0, eqnB == 0, eqnC == 0, 0 <= t <= 1, 0 <= u <= 1, 0 <= v <= 1}, {t, u, v}, Reals] False Relaxing the constraints Reduce[{eqnA == 0, eqnB == 0, eqnC == 0, 0 <= t, 0 <= u, 0 <= v}, {t, u, v}, Reals, Backsubstitution -> True] // N (t == 4.40375 && u == 1914.31 && v == 0.0657319) || (t == 5.3339 && u == 1442.6 && v == 1.36694) Bob Hanlon ---- leongz <leongz86 at gmail.com> 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]