MathGroup Archive 2003

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

Search the Archive

RE: Problems defining function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40403] RE: [mg40374] Problems defining function
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 4 Apr 2003 01:21:53 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Vadim,

I don't obtain that result, either in a Plot or in a Table.

h[x_] := 0 /; x < 0
h[x_] := x /; x >= 0

Table[h[x], {x, -1, 1, 0.25}]
{0, 0, 0, 0, 0., 0.25, 0.5, 0.75, 1.}

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 




From: Vadim Nagornyi [mailto:vnagornyi at netscape.net]
To: mathgroup at smc.vnet.net


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.



  • Prev by Date: Re: Problems defining function
  • Next by Date: Re: Problems defining function
  • Previous by thread: Re: Problems defining function
  • Next by thread: Re: Problems defining function