Re: Problems defining function
- To: mathgroup at smc.vnet.net
- Subject: [mg40396] Re: [mg40374] Problems defining function
- From: SONKOLY Pal <phaul at inf.elte.hu>
- Date: Fri, 4 Apr 2003 01:21:13 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Im not sure, and i cannot reach any copy of mathematica here, but i think
it'll work if you place the condition into the argument list like this:
h[x_ /; x<0] := 0
h[x_ /; x>=0] := x
Phaul
On Thu, 3 Apr 2003, Vadim Nagornyi wrote:
> Hello,
> I am defining a function:
> h[x_]:=0/;x<0
> h[x_]:=x/;x>=0
>
> When I try to plot the function:
> Plot[h[x],{x,-1,1}]
>
> I see that it's defined as h[x_]:=x on all values, not only positive ones.
> What am I missing here?
>
> Thanks.
> Vadim.
>
>