MathGroup Archive 2005

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

Search the Archive

Re: Warning from Piecewise

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61559] Re: Warning from Piecewise
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Sat, 22 Oct 2005 00:36:11 -0400 (EDT)
  • References: <dja298$fhh$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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