MathGroup Archive 2005

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

Search the Archive

Re: Warning from Piecewise


Hello,

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

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

foo


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
http://www.dbaileyconsultancy.co.uk


  • 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