MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Refine, assumptions, domains

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101765] Re: Refine, assumptions, domains
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Thu, 16 Jul 2009 08:20:37 -0400 (EDT)
  • References: <h3hjkc$1ue$1@smc.vnet.net> <h3hqqr$5l3$1@smc.vnet.net>

On Jul 15, 2:08 pm, Richard Fateman <fateman at cs.berkeley.edu> wrote:
> Jon McLoone wrote:
> > How about...
>
> > 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[1] 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]]}
>
> The answer comes out
> {0 || Pi, 2*Pi || 3*Pi}
>
> which is pretty close;   % /. Or->List //Flatten  does the rest, give=
n
> that particular form.
>

Try this:

In[8]:= Reduce[Sin[x] == 0 && 0 < x < 10, x]

Out[8]= x == \[Pi] || x == 2 \[Pi] || x == 3 \[Pi]

In[9]:= x /. {ToRules[%]}

Out[9]= {\[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.


  • Prev by Date: Re: Re: Refine, assumptions, domains
  • Next by Date: Re: Determine if a parameter is a function
  • Previous by thread: Re: Re: Refine, assumptions, domains
  • Next by thread: Re: Re: Refine, assumptions, domains