MathGroup Archive 2005

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

Search the Archive

Re: piecewise vs which

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60129] Re: piecewise vs which
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sun, 4 Sep 2005 03:01:52 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, U.K.
  • References: <200509020833.EAA05912@smc.vnet.net> <dfbf3g$io7$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Curtis Osterhoudt wrote:
> Hi, Bradley,
> 
>    Some similar questions -- but with limits of +/- Infinity  -- have
> been bantered about on this group recently regarding limits.
> 
>    The Piecewise function returns 0 as a default value when a domain
> isn't given for an argument. I found this from the command ?Piecewise,
> but it's also in the fuller Help Index documentation, of course. If you
> make a larger "gap", say,
> 
> f[x_] := Piecewise[{{x^2, x < 2}, {3*x, x > 10}}]
> 
> 
> then Piecewise will return 0 for values for 2<= x <= 10.
> 
> For the students' sake you might define f to return Null at
> "unspecified" arguments, with
> 
> f[x_] := Piecewise[{{x^2, x < 2}, {3*x, x > 10}}, Null]
> 
> 
> This should plot and behave more as you expect. Also, the Limit function
> now works as you'd expect, including directed limits: try
> 
>  Limit[f[x], x -> 2, Direction -> 1]   
> 
> vs.
> 
>  Limit[f[x], x -> 2].
> 
Hi Curtis,

I might have miss something but the issue about the limit does not seem 
to be solved if the function is only discontinuous at one point, say 2 
as in the original question, rather than not being defined over an 
interval. Compare

In[1]:=
Clear[f]
f[x_] := Piecewise[{{x^2, x < 2}, {3*x, x > 10}}, Null]
Limit[f[x], x -> 2, Direction -> 1]
Limit[f[x], x -> 2, Direction -> -1]
Limit[f[x], x -> 2]

Out[3]=
4

versus

In[6]:=
Clear[f]
f[x_] := Piecewise[{{x^2, x < 2}, {3*x, x > 2}}, Null]
Limit[f[x], x -> 2, Direction -> 1]
Limit[f[x], x -> 2, Direction -> -1]
Limit[f[x], x -> 2]

Out[8]=
4

Out[9]=
6

Out[10]=
6

In[11]:=
$Version

Out[11]=
"5.2 for Microsoft Windows (June 20, 2005)"

I believe, although I may be wrong, that the limit can be handled 
correctly only by defining your own limit function (see for example 
David Park's message in this thread).

Best regards,
/J.M.


  • Prev by Date: Re: hints to speed up numerical integration?
  • Next by Date: Re: Would a code generator from dynamic systems be feasible and useful?
  • Previous by thread: Re: piecewise vs which
  • Next by thread: Re: piecewise vs which