Re: Re: Wrong limit?

*To*: mathgroup at smc.vnet.net*Subject*: [mg104948] Re: [mg104846] Re: Wrong limit?*From*: Adam Strzebonski <adams at wolfram.com>*Date*: Sat, 14 Nov 2009 01:57:16 -0500 (EST)*References*: <200911061014.FAA07962@smc.vnet.net> <hdbha5$jg8$1@smc.vnet.net> <200911121059.FAA18372@smc.vnet.net> <D1312EAF-941E-4C71-98D4-3D05D1E67798@mimuw.edu.pl>*Reply-to*: adams at wolfram.com

The difference between Reduce and Resolve in this example is that Reduce uses cylindrical algebraic decomposition (because it needs to produce a result solved for the free variables) and Resolve uses virtual substitution. Virtual substitution is often faster than cylindrical algebraic decomposition, but not for this example. Unfortunately, there is no way to tell a priori which method will be faster and the difference is often between one method hanging and the other returning reasonably fast. One way of solving this problem would be to try both methods in parallel. In[2]:= LaunchKernels[2] Out[2]= {KernelObject[1, "local"], KernelObject[2, "local"]} In[3]:= ParallelQE[form_] := ParallelTry[#[form, Reals] &, {Resolve, Reduce}] In[6]:= ParallelQE[ ForAll[eps, eps > 0, Exists[del, del > 0, ForAll[x, Implies[0 < Abs[x - a] < del, Abs[(x^2 - a^2)/(5 x^2 - 4 a x - a^2) - M] < eps]]]]] // AbsoluteTiming Out[6]= {12.181224, (a < 0 && M == 1/3) || (a == 0 && M == 1/5) || (a > 0 && M == 1/3)} I have run this on a single processor machine, so ParallelQE is slower than Reduce. If my computer had two (or more) processors there should be not much timing difference between ParallelQE and the faster of Reduce and Resolve. Best regards, Adam Strzebonski Wolfram Research Andrzej Kozlowski wrote: > I find it curious (and perhaps slightly disappointing) that replacing Reduce by Resolve seems to fail (or at least it outruns my patience while Reduce does not). This is puzzling because Resolve and not Reduce is supposed to be "the principal tool" for quantifier elimination and, according to the documentation "Resolve is in effect automatically applied by Reduce." Presumably Reduce applies some additional transformations not available to Resolve, which make it possible for it to succeed where Resolve fails (or takes far too long), but what could they be? > > Andrzej Kozlowski > > > On 12 Nov 2009, at 19:59, Maxim wrote: > >> On Nov 10, 5:03 am, DrMajorBob <btre... at austin.rr.com> wrote: >>> One could hope that Mathematica covered all cases in every symbolic >>> calculation, but it's not possible, and if it were, it would frequently be >>> inefficient. >>> >>> Consider the simple quadratic: >>> >>> Solve[a x^2 + b x + c == 0, x] >>> >>> {{x -> (-b - Sqrt[b^2 - 4 a c])/( >>> 2 a)}, {x -> (-b + Sqrt[b^2 - 4 a c])/(2 a)}} >>> >>> That's wrong when a == 0, just as in your Limit problem. >>> >>> Reduce is more complete, if that's what we want... but do we really want >>> every computation cluttered to the maximum degree? >>> >>> Reduce[a x^2 + b x + c == 0, x] >>> >>> (a != 0 && (x == (-b - Sqrt[b^2 - 4 a c])/(2 a) || >>> x == (-b + Sqrt[b^2 - 4 a c])/(2 a))) || (a == 0 && b= >> != 0 && >>> x == -(c/b)) || (c == 0 && b == 0 && a == 0) >>> >>> Bobby >>> >>> On Fri, 06 Nov 2009 04:14:48 -0600, wiso <gtu2... at alice.it> wrote: >>>> Look at this: >>>> Limit[(x^2 - a^2)/(5 x^2 - 4 a x - a^2), x -> a] >>>> Mathematica answer = 1/3 >>>> this is ok for a !=0, but if a = 0 the value is >>>> Limit[(x^2 - a^2)/(5 x^2 - 4 a x - a^2) /. a -> 0, x -> 0] >>>> 1/5 >>> -- >>> DrMajor... at yahoo.com >> Interestingly, the original problem can actually be solved using >> Reduce: >> >> In[1]:= Reduce[ >> ForAll[eps, eps > 0, Exists[del, del > 0, ForAll[x, >> Implies[0 < Abs[x - a] < del, >> Abs[(x^2 - a^2)/(5 x^2 - 4 a x - a^2) - M] < eps]]]], Reals] >> >> Out[1]= (a < 0 && M == 1/3) || (a == 0 && M == 1/5) || (a > 0= >> && M == >> 1/3) >> >> One just has to be careful to make sure the expressions do not become >> indeterminate, otherwise the meaning of the quantifiers is not really >> well defined. E.g., >> >> In[2]:= Reduce[ForAll[x, x >= 0, 1/x > a]] >> >> Out[2]= False >> >> In[3]:= Reduce[ForAll[x, x >= 0, 1/x > 0]] >> >> Out[3]= True >> >> Maxim Rytin >> m.r at inbox.ru >> >

**References**:**Wrong limit?***From:*wiso <gtu2003@alice.it>

**Re: Wrong limit?***From:*Maxim <m.r@inbox.ru>

**Re: Dialogue box generator**

**Re: Non-Linear pendulum**

**Re: Re: Wrong limit?**

**Re: Re: Re: Wrong limit?**