MathGroup Archive 2007

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

Search the Archive

Re: FindInstance puzzler

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83747] Re: FindInstance puzzler
  • From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
  • Date: Thu, 29 Nov 2007 06:36:36 -0500 (EST)
  • References: <200711260849.DAA29897@smc.vnet.net> <55F7C11F-CAB8-47B4-AE40-DA470C74C8C1@mimuw.edu.pl> <474AF639.50705@wolfram.com> <52B4543A-8103-4C24-9786-8C554D247748@mimuw.edu.pl> <4B6A6861-0084-47E8-9A27-8669BE71D6CE@mimuw.edu.pl> <474C80D1.8010000@wolfram.com> <fijiam$in5$1@smc.vnet.net>

Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote:
> On 28 Nov 2007, at 05:40, Adam Strzebonski wrote:
>
> > Andrzej Kozlowski wrote:
> >> *This message was transferred with a trial version of
> >> CommuniGate(tm) Pro*
> >> On 27 Nov 2007, at 17:05, Andrzej Kozlowski wrote:
> >>> Reduce[2*y*I*Sqrt[x] + 2*(y - I*Sqrt[x]) == 0, {x, y}, Reals]
> >> This should have been:
> >> In[17]:= Reduce[2*y*I*Sqrt[x] + 2*(y - y*I*Sqrt[x]) == 0,
> >>  {x, y}, Reals]
> >> During evaluation of In[17]:= Reduce::nddc:The system 2 \
> >> [ImaginaryI] Sqrt[x] y+2 (y-\[ImaginaryI] Sqrt[x] y)\[LongEqual]0
> >> contains a nonreal constant 2 \[ImaginaryI]. With the domain \
> >> [DoubleStruckCapitalR] specified, all constants should be real. >>
> >> Out[17]= Reduce[2*I*Sqrt[x]*y + 2*(y - I*Sqrt[x]*y) == 0,
> >>  {x, y}, Reals]
> >> but it other than that it does not change anything. Note that:
> >> Reduce[Simplify[2*y*I*Sqrt[x] + 2*(y - y*I*Sqrt[x]) == 0], {x, y},
> >> Reals]
> >> y==0
> >> What I really mean tto say is: wouldn't it be a litte better to
> >> first automatically apply Simplify in such situation to see if the =
>
> >> I's could be got rid of?
> >> Andrzej Kozlowski
> >
> > It think this behaviour is correct. Reduce should disallow any non-
> > real
> > subexpressions when the domain Reals is specified. The fact that it
> > cannot detect potentially non-real functions that cancel during input
> > processing is more problematic, but hard to avoid.
> >
> > Adam Strzebonski
>
> Well yes, but... There are plenty of real valued functions for which
> it is hard to give an explicit expression not involving complex
> numbers.

Agreed, but the function below is not a very good example since it's just
Sqrt[Abs[Sin[x]]]. Does anyone know how to get Mathematica to make that
simplification when x is real?

> For example, the function
>
> g[x_] := Sec[(1/2)*Arg[I*Sin[x]]]*(Sqrt[I*Sin[x]] -
> I*Sqrt[Abs[Sin[x]]]*Sin[(1/2)*Arg[I*Sin[x]]])
>
> is always real valued for real x. In fact, Mathematica is able to show
> that this is so:
>
> ComplexExpand[Im[g[x]], TargetFunctions -> {Re, Im}]
> 0
>
> Moreover, Mathematica can even solve  (well, almost) the following:
>
> Reduce[g[x] == 1 && Element[x, Reals], x]
>
> Reduce::ztest:Unable to decide whether numeric quantities {1/8 (-8
> tan-1(1-Power(<<2>>))-=CF=80)} are equal to zero. Assuming they are. >>
>
> Element[C[1], Integers] && (x == (1/2)*(4*Pi*C[1] - Pi) || x ==
> (1/2)*(4*Pi*C[1] + 3*Pi) || x == (1/2)*(4*Pi*C[1] + Pi))
>
> But even so, it won't even touch:
>
>   Reduce[g[x] == 1, x,Reals]

OTOH, Mathematica (at least version 5.2) does the following without
complaint:

In[6]:= Reduce[Sqrt[Abs[Sin[x]]] == 1, x, Reals]

Out[6]= Element[C[1], Integers] && (x == -(Pi/2) + 2*Pi*C[1] ||
x == (3*Pi)/2 + 2*Pi*C[1] || x == Pi/2 + 2*Pi*C[1])

That result is obviously equivalent to just

Element[C[1], Integers] && x == Pi/2 + Pi*C[1].

I would guess that there might be an easy way to get
Mathematica to simplify Out[6] to something like
Element[C[1], Integers] && x == Pi/2 + Pi*C[1]. Is there such a way?

David W. Cantrell

> I guess the reason why I am not happy about it is that I am used to
> telling students that an expression is not "complex" valued just
> because it has complex numbers in it. This behaviour would seem to
> confirm them in this, in my opinion, quite wrong anti-complex
> prejudice. Still, I admit, being able to dismiss certian inputs out of
> hand,  clearly makes the job of a CAS easier  ;-)
>
> Andrzej Kozlowski=


  • Prev by Date: Re: PlotLabel - SubscriptBox - Vers. 6: FontColor not working?
  • Next by Date: Re: Re: Possible bug in HamiltonianCycle
  • Previous by thread: Re: FindInstance puzzler
  • Next by thread: Re: FindInstance puzzler