Condition for pure functions
- To: mathgroup at smc.vnet.net
- Subject: [mg59797] Condition for pure functions
- From: "Wonseok Shin" <wssaca at gmail.com>
- Date: Sun, 21 Aug 2005 03:51:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hello everyone, Suppose that f[x] is defined as: f[x_ /; x > 0] := Sin[x]; f[x_ /; x <= 0] := Tan[x]; How can transform the above definition into a pure function? I know f = Which[# > 0, Sin[#], # <= 0, Tan[#]] & is a one solution. But is there any clever way to use Condition (/;) instead of Which[...] ?
- Follow-Ups:
- Re: Condition for pure functions
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: Condition for pure functions
- From: Pratik Desai <pdesai1@umbc.edu>
- Re: Condition for pure functions