Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #3193 > unrolled thread

Re: Why doesn't TrueQ return True here?

Started byBob Hanlon <hanlonr@cox.net>
First post2011-06-20 12:05 +0000
Last post2011-06-21 09:52 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: Why doesn't TrueQ return True here? Bob Hanlon <hanlonr@cox.net> - 2011-06-20 12:05 +0000
    Re: Why doesn't TrueQ return True here? Jacare Omoplata <walkeystalkey@gmail.com> - 2011-06-20 23:37 +0000
      Re: Why doesn't TrueQ return True here? Jacare Omoplata <walkeystalkey@gmail.com> - 2011-06-21 09:52 +0000

#3193 — Re: Why doesn't TrueQ return True here?

FromBob Hanlon <hanlonr@cox.net>
Date2011-06-20 12:05 +0000
SubjectRe: Why doesn't TrueQ return True here?
Message-ID<itnd1n$7h2$1@smc.vnet.net>
??$Assumptions

$Assumptions is the default setting for the Assumptions option used in such functions as Simplify, Refine and Integrate. =C2 >>

$Assumptions=True


TrueQ is not one of the functions that makes use of $Assumptions.

$Assumptions = t2 > t1;

Simplify[(t2 - t1) > 0]

True

TrueQ[Simplify[(t2 - t1) > 0]]

True


Bob Hanlon

---- Jacare Omoplata <walkeystalkey@gmail.com> wrote:

=============
Here's the output.
-------------------------------------------------------
In[29]:= Element[{t1, t2}, Reals]

Out[29]= (t1 | t2) \[Element] Reals

In[30]:= $Assumptions = t2 > t1

Out[30]= t2 > t1

In[31]:= TrueQ[(t2 - t1) > 0]

Out[31]= False
------------------------------------------------------

I would expect TrueQ to return True, not False. Why does it return False?

And how can I test whether t2-t1 is positive?

Thanks.

[toc] | [next] | [standalone]


#3205

FromJacare Omoplata <walkeystalkey@gmail.com>
Date2011-06-20 23:37 +0000
Message-ID<itoljh$eqh$1@smc.vnet.net>
In reply to#3193
Thanks for the answers. I'll use Simplify in the future. I also
learned that TrueQ is just used to force a True or False answer out.
It gives True when the answer is explicitly true, and gives False in
all other instances. I guess this is useful in programming.

So, if I wanted Mathematica to work on t1 and t2 like real numbers I
should use "$Assumptions = Element[{t1,t2},Reals]" ?

It does SOMETHING, according to the following output, because Out[3],
where I've used t1 and t2, is different from Out[4], where I've used
the undeclared variables s1 and s2.

But it still doesn't give t2-t1 as the answer, but gives Abs[t1-t2]
instead. But I get t2-t1 as the answer in Out[6] and Out[7], where I
have declared that t2>t1 beforehand.

-----------output-below-------------

In[1]:= $Assumptions = Element[{t1, t2}, Reals]

Out[1]= (t1 | t2) \[Element] Reals

In[3]:= FullSimplify[Sqrt[(t2 - t1)^2]]

Out[3]= Abs[t1 - t2]

In[4]:= FullSimplify[Sqrt[(s2 - s1)^2]]

Out[4]= Sqrt[(s1 - s2)^2]

In[5]:= $Assumptions = t2 > t1

Out[5]= t2 > t1

In[6]:= FullSimplify[Sqrt[(t2 - t1)^2]]

Out[6]= -t1 + t2

In[7]:= FullSimplify[Sqrt[(t1 - t2)^2]]

Out[7]= -t1 + t2

In[10]:= $Assumptions = Element[{t1, t2}, Complexes]

Out[10]= (t1 | t2) \[Element] Complexes

In[11]:= FullSimplify[Sqrt[(t2 - t1)^2]]

Out[11]= Sqrt[(t1 - t2)^2]

In[12]:= FullSimplify[Sqrt[(s2 - s1)^2]]

Out[12]= Sqrt[(s1 - s2)^2]


On Jun 20, 8:05 am, Bob Hanlon <hanl...@cox.net> wrote:
> ??$Assumptions
>
> $Assumptions is the default setting for the Assumptions option used in such functions as Simplify, Refine and Integrate.  >>
>
> $Assumptions=True
>
> TrueQ is not one of the functions that makes use of $Assumptions.
>
> $Assumptions = t2 > t1;
>
> Simplify[(t2 - t1) > 0]
>
> True
>
> TrueQ[Simplify[(t2 - t1) > 0]]
>
> True
>
> Bob Hanlon
>
> ---- Jacare Omoplata <walkeystal...@gmail.com> wrote:
>
> =============
> Here's the output.
> -------------------------------------------------------
> In[29]:= Element[{t1, t2}, Reals]
>
> Out[29]= (t1 | t2) \[Element] Reals
>
> In[30]:= $Assumptions = t2 > t1
>
> Out[30]= t2 > t1
>
> In[31]:= TrueQ[(t2 - t1) > 0]
>
> Out[31]= False
> ------------------------------------------------------
>
> I would expect TrueQ to return True, not False. Why does it return False?
>
> And how can I test whether t2-t1 is positive?
>
> Thanks.

[toc] | [prev] | [next] | [standalone]


#3207

FromJacare Omoplata <walkeystalkey@gmail.com>
Date2011-06-21 09:52 +0000
Message-ID<itppl4$kcm$1@smc.vnet.net>
In reply to#3205
OK, now that I'm reading what I've posted yesterday, it makes no
sense, I guess because I was practically dozing in my chair when I
wrote that. Of course, Mathematica gave Abs[t1-t2] as the answer
because it didn't know which one was greater. When it had the
information that t2>t1, it evaluated Abs[t1-t2] and returned t2-t1 .
Sorry about that stupid mistake.

On Jun 20, 7:37 pm, Jacare Omoplata <walkeystal...@gmail.com> wrote:
> Thanks for the answers. I'll use Simplify in the future. I also
> learned that TrueQ is just used to force a True or False answer out.
> It gives True when the answer is explicitly true, and gives False in
> all other instances. I guess this is useful in programming.
>
> So, if I wanted Mathematica to work on t1 and t2 like real numbers I
> should use "$Assumptions = Element[{t1,t2},Reals]" ?
>
> It does SOMETHING, according to the following output, because Out[3],
> where I've used t1 and t2, is different from Out[4], where I've used
> the undeclared variables s1 and s2.
>
> But it still doesn't give t2-t1 as the answer, but gives Abs[t1-t2]
> instead. But I get t2-t1 as the answer in Out[6] and Out[7], where I
> have declared that t2>t1 beforehand.
>
> -----------output-below-------------
>
> In[1]:= $Assumptions = Element[{t1, t2}, Reals]
>
> Out[1]= (t1 | t2) \[Element] Reals
>
> In[3]:= FullSimplify[Sqrt[(t2 - t1)^2]]
>
> Out[3]= Abs[t1 - t2]
>
> In[4]:= FullSimplify[Sqrt[(s2 - s1)^2]]
>
> Out[4]= Sqrt[(s1 - s2)^2]
>
> In[5]:= $Assumptions = t2 > t1
>
> Out[5]= t2 > t1
>
> In[6]:= FullSimplify[Sqrt[(t2 - t1)^2]]
>
> Out[6]= -t1 + t2
>
> In[7]:= FullSimplify[Sqrt[(t1 - t2)^2]]
>
> Out[7]= -t1 + t2
>
> In[10]:= $Assumptions = Element[{t1, t2}, Complexes]
>
> Out[10]= (t1 | t2) \[Element] Complexes
>
> In[11]:= FullSimplify[Sqrt[(t2 - t1)^2]]
>
> Out[11]= Sqrt[(t1 - t2)^2]
>
> In[12]:= FullSimplify[Sqrt[(s2 - s1)^2]]
>
> Out[12]= Sqrt[(s1 - s2)^2]
>
> On Jun 20, 8:05 am, Bob Hanlon <hanl...@cox.net> wrote:
>
>
>
>
>
>
>
> > ??$Assumptions
>
> > $Assumptions is the default setting for the Assumptions option used in =
such functions as Simplify, Refine and Integrate.  >>
>
> > $Assumptions=True
>
> > TrueQ is not one of the functions that makes use of $Assumptions.
>
> > $Assumptions = t2 > t1;
>
> > Simplify[(t2 - t1) > 0]
>
> > True
>
> > TrueQ[Simplify[(t2 - t1) > 0]]
>
> > True
>
> > Bob Hanlon
>
> > ---- Jacare Omoplata <walkeystal...@gmail.com> wrote:
>
> > =============
> > Here's the output.
> > -------------------------------------------------------
> > In[29]:= Element[{t1, t2}, Reals]
>
> > Out[29]= (t1 | t2) \[Element] Reals
>
> > In[30]:= $Assumptions = t2 > t1
>
> > Out[30]= t2 > t1
>
> > In[31]:= TrueQ[(t2 - t1) > 0]
>
> > Out[31]= False
> > ------------------------------------------------------
>
> > I would expect TrueQ to return True, not False. Why does it return Fals=
e?
>
> > And how can I test whether t2-t1 is positive?
>
> > Thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web