MathGroup Archive 2009

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

Search the Archive

Re: Piecewise vs. /; ?

  • To: mathgroup at
  • Subject: [mg104016] Re: Piecewise vs. /; ?
  • From: Dan Dubin <ddubin at>
  • Date: Thu, 15 Oct 2009 07:19:33 -0400 (EDT)
  • References: <hashpc$qu8$> <hav19a$4gr$>

Folks --

I would respectfully disagree with the idea that /; is more general 
than Piecewise. The example given, a function that returns a 
different value in the morning than the evening, is simply a 
time-dependent function that could be constructed using Piecewise, as 

f[x_,h_] =  Piecewise[{{x, h < 12}, {-x, h >= 12}}];

and called via


  In fact, it seems to me that any difference in the way that 
Mathematica interprets Piecewise and conditionals should be removed 
from later editions of Mathematica, since as far as I can see the 
difference between them is merely a Mathematica-specific  matter of 
the mechanics of how the expressions are evaluated with little (or 
no?) utility, that causes considerable confusion among new users. I 
don't see any benefit in this distinction, but feel free to convince 
me otherwise!

>Szabolcs Horv=E1t wrote:
>>  In short, /; is a programming construct that affects evaluation.
>>  Piecewise[] is used to represent a mathematical concept: piecewise
>>  functions.
>>  If you want to do mathematical operations like integration, then use
>>  Piecewise[].  Condition[] (/;) is a lot more general than Piecewise[],
>>  for example one could write a "function" that returns a different value
>>  in the evening than in the morning, which is obviously not a function in
>>  the mathematical sense, and thus can't be integrated.
>Got it!  Thanks to you and David for responding.
>Erik Max Francis && max at &&
>   San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
>    God is love, but get it in writing.
>     -- Gypsy Rose Lee


  • Prev by Date: Re: generating submultisets with repeated elements
  • Next by Date: Re: generating submultisets with repeated elements
  • Previous by thread: Re: Piecewise vs. /; ?
  • Next by thread: Re: Piecewise vs. /; ?