Re: FindInstance does not abort with TimeConstrained
- To: mathgroup at smc.vnet.net
- Subject: [mg115449] Re: FindInstance does not abort with TimeConstrained
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Tue, 11 Jan 2011 06:58:36 -0500 (EST)
Deleting all the Simplify and Chop stuff since it doesn't do anything but take up time, we can write: 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; Solve[{eqnA == 0, eqnB == 0, eqnC == 0}, {t, u, v}] {{t -> -3.19687, u -> 3.28488, v -> -3.31651}, {t -> -2.33029, u -> 720.405, v -> -8.27168}, {t -> -0.606671, u -> 1245.81, v -> -6.30374}, {t -> -0.280957, u -> 2.95134, v -> 0.688093}, {t -> 4.40375, u -> 1914.31, v -> 0.0657319}, {t -> 5.3339, u -> 1442.6, v -> 1.36694}} None of the solutions satisfy your bounds on the variables. There is also a warning message, but I suspect Solve did what is possible. You can replace the reals using Rationalize[#,0]&, but Solve found no solutions in that case. Bobby On Mon, 10 Jan 2011 23:30:54 -0600, 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] > -- DrMajorBob at yahoo.com