Re: Conditional evaluation
- To: mathgroup at smc.vnet.net
- Subject: [mg34313] Re: Conditional evaluation
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 14 May 2002 04:12:38 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <abo3d7$5dm$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, very compilcated problem, and myFunc[x_?NumericQ] /; x < 1 := x^2 myFunc[x_?NumericQ] /; x > 1 := -x^2 myFunc[x_] := IMatchAlways does not help ? Regards Jens Tim Ebringer wrote: > > Greetings gurus, > > Does anyone know how to do the expression If[expr, a, b, b] using the > conditional /; operation, i.e. > > myFunc[x_]:=a /; expr > myFunc[x_]:=b /; <otherwise> > > I could do it using the If function, but would much prefer, for layout > reasons, to use the conditional operator, but I can't seem to make it do the > "otherwise" part. Note that !expr doesn't work in this case because it > doesn't evaluate. > > Cheers, > > Tim.