       Re: Re: Refine, assumptions, domains

• To: mathgroup at smc.vnet.net
• Subject: [mg101788] Re: [mg101765] Re: Refine, assumptions, domains
• From: Andrzej Kozlowski <akozlowski at gmail.com>
• Date: Fri, 17 Jul 2009 05:03:08 -0400 (EDT)
• References: <h3hjkc\$1ue\$1@smc.vnet.net> <h3hqqr\$5l3\$1@smc.vnet.net> <200907161220.IAA02590@smc.vnet.net>

```On 16 Jul 2009, at 05:20, Szabolcs wrote:

> On Jul 15, 2:08 pm, Richard Fateman <fateman at cs.berkeley.edu> wrote:
>> Jon McLoone wrote:
>>
>>> n Pi /. {ToRules[Reduce[0 < n*Pi < 10 && Element[n, Integers], n]]}
>>
>>> On Jul 14, 10:37 am, Richard Fateman <fate... at cs.berkeley.edu>
>>> wrote:
>>>> What I'm looking for is a simple way to obtain a finite list
>>
>>>> { Pi, 2 Pi, 3 Pi}
>>
>>>> from  this information:
>>
>>>>   0< n*Pi < 10,  Element[n,Integers]
>>
>>>> Refine doesn't do this, at least with Mathematica 6.0
>>>> Suggestions? (cc to fate... at gmail.com would be nice.)
>>
>> Thanks for the suggestions!
>>
>> What I really wanted was a way of finding the solutions of any
>> equation,
>> say Sin[x]==0 that lie in a particular range, say the range 0 to 10.
>> Naturally, I prefer that this be done symbolically and exactly rather
>> than numerically, when possible.
>>
>> If we try
>>
>> Reduce[Sin[x]==0,x].
>>
>> After replacing the dummy name C by n, the answer condition is
>> Element[n, Integers] && (x == 2*n*Pi || x == Pi + 2*n*Pi)
>>
>> which is correct but clumsy.
>>
>> Automatically mapping this into Jon's construction, is hairier.
>> If we can manage to get this...
>> (2 n Pi || Pi + 2 n Pi) /. {ToRules[
>>    Reduce[((0 < 2*n*Pi < 10) || (0 < Pi + 2*n*Pi < 10)) &&
>>      Element[n, Integers], n]]}
>>
>> {0 || Pi, 2*Pi || 3*Pi}
>>
>> which is pretty close;   % /. Or->List //Flatten  does the rest,
>> give=
> n
>> that particular form.
>>
>
> Try this:
>
> In:= Reduce[Sin[x] == 0 && 0 < x < 10, x]
>
> Out= x == \[Pi] || x == 2 \[Pi] || x == 3 \[Pi]
>
> In:= x /. {ToRules[%]}
>
> Out= {\[Pi], 2 \[Pi], 3 \[Pi]}
>
> In Mathematica 7 this works even for equation that can only solved
> numerically.  In Mathematica 6, it will only work for those eqs that
> the system can handle symbolically.
>

Reduce always solves equations "symbolically" whether in Mathematica 7
or earlier versions. Isolation of roots is sometimes performed
numerically but this is symbolically validated isolation, in other
words, it is "provably correct".
And, by the way, Mathematica 6 gives:

In:= Reduce[Sin[x] == 0 && 0 < x < 10, x]
Out= x == Pi || x == 2*Pi || x == 3*Pi
In:= \$Version
Out= "6.0 for Mac OS X x86 (64-bit) (May 21, 2008)"

Andrzej Kozlowski

```

• Prev by Date: Re: eigenvector centrality
• Next by Date: Re: Assigning Values to Many Symbols at Once
• Previous by thread: Re: Refine, assumptions, domains
• Next by thread: Copy Greek text as Unicode?