MathGroup Archive 2002

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

Search the Archive

Re: Define a function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34609] Re: Define a function
  • From: Mark Westwood <MarkCWestwood at compuserve.com>
  • Date: Wed, 29 May 2002 02:46:45 -0400 (EDT)
  • References: <acshar$ke2$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Michael

Try:

f[x_]:=0 /;x<10
f[x_]:=x /;10<x<20
etc

Note that your function is undefined at 10 and at 20.

Regards
Mark



Michael Popp wrote:
> 
> Hello
> 
> I want to define a function in Mathematica. But just f[x_]:=...  does not
> work, because I have to define different functions for different ranges of
> the variable x.
> For example:
> 
> x < 10:           f(x) = 0
> 10 < x < 20:  f(x) = x
> 20 < x:          f(x) = x/2
> 
> How to do this?
> 
> Thanks, greetings
> Michael


  • Prev by Date: Re: Define a function
  • Next by Date: Re: Define a function
  • Previous by thread: Re: Define a function
  • Next by thread: Re: Define a function