Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Definitions of the functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34980] Re: [mg34963] Definitions of the functions
  • From: Hugh Walker <hwalker at gvtc.com>
  • Date: Mon, 17 Jun 2002 03:26:58 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On Saturday, June 15, 2002, at 11:23 PM, Pawe³ Ga³ecki wrote:

> How do I define a function that is described by different formulas 
> depending
> of the interval which the argument is given in????
> For example:
>
> y=x             for  -inf<x<-5
> y=x*x          for  -5<=x<18
> y=sin x        for all the remaining values of x.
>
>
> Anybody got a clue???
>
> Thanks,
> Paweâ?¥ Gaâ?¥ecki
>
>
>
>
>
>

There are several ways to do this; here is one of them

func[x_]:=x/;x<-5;
func[x_]:=x^2/;xâ?¥-5&&x<18;
func[x_]:= Sin[x];

============
   Hugh Walker
    Gnarly Oaks



  • Prev by Date: Re: Definitions of the functions
  • Next by Date: Re: Problem with hypergeometric function
  • Previous by thread: Re: Definitions of the functions
  • Next by thread: RE: Definitions of the functions