MathGroup Archive 2005

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

Search the Archive

Re: piecewise vs which

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60115] Re: piecewise vs which
  • From: "dkr" <dkrjeg at adelphia.net>
  • Date: Sat, 3 Sep 2005 02:06:02 -0400 (EDT)
  • References: <df9437$620$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

This is not a bug.  By default Piecewise gives a value of 0 if none of
the conditions apply. But you can add an extra argument to change that
default.

In[1]:=
f[x_]:=Piecewise[{{x^2,x<2},{3x,x>2}},Null];
In[2]:=
f[2]
In[3]:=
 g[x_]=Which[x<2,x^2,x>2,3x];
In[4]:=
g[2]


  • Prev by Date: Please explain this weird Integrate result
  • Next by Date: ComplexExpand confusion
  • Previous by thread: Re: piecewise vs which
  • Next by thread: Re: piecewise vs which