Re: FindInstance returning incorrect results
- To: mathgroup at smc.vnet.net
- Subject: [mg71390] Re: [mg71344] FindInstance returning incorrect results
- From: Adam Strzebonski <adams at wolfram.com>
- Date: Thu, 16 Nov 2006 00:53:54 -0500 (EST)
- References: <200611151144.GAA01342@smc.vnet.net> <C935A578-CC0A-4330-9AC5-9D9D5E6C1077@mimuw.edu.pl>
- Reply-to: adams at wolfram.com
This is a known bug that has been fixed in the development version. To fix it in Mathematica 5.2 add the following code to your init.m file. (*** begin fix ***) Reduce`CPInstance; System`ReduceDump`drltvars[f_, vars_] := First/@Select[Transpose[ {vars, Internal`DistributedTermsList[f, vars, CoefficientDomain -> RationalFunctions, Modulus -> 0, MonomialOrder -> DegreeReverseLexicographic, Sort -> False][[1, 1, 1]]}], #[[2]]=!=0&] (*** end fix ***) Now FindInstance finds a correct solution: In[2]:= FindInstance[c*c== -1 && c*d == I, {c,d}] Out[2]= {{c -> -I, d -> -1}} In[3]:= FindInstance[c*c == -1 && c*d == I && c != 0, {c, d}] Out[3]= {{c -> -I, d -> -1}} Best Regards, Adam Strzebonski Wolfram Research Andrzej Kozlowski wrote: > *This message was transferred with a trial version of CommuniGate(tm) Pro* > You are using FindInstance correctly and it seems you have found a bug. > Besides your another thing that suggest that something is wrong is this: > > In[59]:= > FindInstance[c*c == -1 && c*d == I && c != 0, {c, d}] > > From In[59]:= > "TriangularSet in Reduce.m is incorrect" > > Out[59]= > {{c -> -I, d -> -1}} > > > This is with > > In[60]:= > $Version > > Out[60]= > 5.1 for Mac OS X (October 25, 2004) > > Andrzej Kozlowski > > > > On 15 Nov 2006, at 20:44, Jason Grout wrote: > >> I ran into the following problem with FindInstance today. Is this a >> known problem? Am I using FindInstance correctly? A simple example >> where the problem comes up is in finding values c and d such that c^2=-1 >> and c*d=I. >> >> First, let's make sure a solution exists: >> >> Clear[c,d]; Solve[{c*c== -1, c*d== I},{c,d}] >> >> gives >> >> {{c -> -I, d -> -1}, {c -> I, d -> 1}}, which is correct. >> >> FindInstance[c*c== -1 && c*d == I, {c,d}] gives the _incorrect_ answer >> {{c -> 0, d -> 0}}. >> >> FindInstance[c*c == -1 && c*d == I, {c,d}, Complexes] >> also gives {{ c -> 0, d -> 0}}, which again is an incorrect answer. >> >> However, if I ask for more than one solution, FindInstance gives correct >> answers. For example: >> >> FindInstance[c*c == -1 && c*d == I, {c,d}, 2] gives the answers that >> Solve gave above. >> >> Am I using FindInstance incorrectly? It seems odd that I get correct >> answers only when I ask for more than one answer. The documentation >> mentions that FindInstance uses a faster method for generating an >> example if only one example is needed--is that causing a problem here? >> Can I be sure that if I ask for more than one answer, I'll get correct >> answers? On a related note, if FindInstance returns {}, does that mean >> a solution does not exist, or merely that FindInstance couldn't find a >> solution? >> >> Thanks, >> >> Jason Grout >> >> -- >> Jason Grout >> jason-mathematica at creativetrax.com >> >
- References:
- FindInstance returning incorrect results
- From: Jason Grout <jason-mathematica@creativetrax.com>
- FindInstance returning incorrect results