Re: Simplifying If expressions
- To: mathgroup at smc.vnet.net
- Subject: [mg102969] Re: Simplifying If expressions
- From: pfalloon <pfalloon at gmail.com>
- Date: Thu, 3 Sep 2009 05:41:01 -0400 (EDT)
- References: <287030.1251791777166.JavaMail.root@n11> <h7l91h$3cj$1@smc.vnet.net>
On Sep 2, 6:06 pm, "David Park" <djmp... at comcast.net> wrote: > If[x == 0, x, 0]; > FullSimplify[%] > 0 > > Piecewise[{{x, x == 0}}, 0]; > FullSimplify[%] > 0 > > David Park > djmp... at comcast.nethttp://home.comcast.net/~djmpark/ > > From: beep.beep [mailto:meph... at gmail.com] > > Hi, > > When I try to Simplify[If[x==0,x,0]] Mathematica returns If[x==0,= x,0] rather > than 0. It seems that it does not take into account that left and right > if-branches should be simplified using ($Assumptions)&&if-condition and > ($Assumptions)&&!if-condition respectively. Is there a way to force that > behaviour? > > Best regards, > Ilya I don't know about anyone else, but I was surprised and troubled to see the following result (as pointed out by others in this thread): In[3]:= If[x==0,x,0] // FullSimplify Out[3]= 0 To me this seems simply incorrect. For example, what about the following cases: In[5]:= With[{x=0.}, If[x==0,x,0]] Out[5]= 0. In[11]:= With[{x=1`20-1}, If[x==0,x,0]] Out[11]= 0.*10^-20 Is this intentional?
- Follow-Ups:
- Re: Re: Simplifying If expressions
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: Simplifying If expressions