MathGroup Archive 2005

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

Search the Archive

Re: Warning from Piecewise

  • To: mathgroup at
  • Subject: [mg61559] Re: Warning from Piecewise
  • From: David Bailey <dave at>
  • Date: Sat, 22 Oct 2005 00:36:11 -0400 (EDT)
  • References: <dja298$fhh$>
  • Sender: owner-wri-mathgroup at


Clearly SetDelayed does some partial evaluation of the left hand side, 
as the following example shows:

f[Print["foo"]] := 1


Unfortunately, Piecewise reports an error if the input is not of the 
right format, rather than leaving it unevaluated. One approach is to write:

Comm[p_[A : {{_, _} ..}], p_[B : {{_, _} ..}]] :=
     Comm[Testy[A], Testy2[B]] /; p === Piecewise

However, it may be easier to work with objects of the form 
myPiecewise[...] - which Mathematica will ignore - and then use 
something like:

expression /.myPiecewise->Piecewise

when you want to let Mathematica manipulate these constructs.

David Bailey

  • Prev by Date: Re: Re: Display sound but suppress graphics
  • Next by Date: Re: refer to the result of FindRoot[ ]
  • Previous by thread: Re: Warning from Piecewise
  • Next by thread: Re: Warning from Piecewise