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: How to ...?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36350] Re: How to ...?
  • From: Bill Rowe <listuser at earthlink.net>
  • Date: Mon, 2 Sep 2002 04:09:16 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 8/31/02 at 1:25 AM, berlusconi_pagliusi at fis.unical.it (Paskoski)
wrote:

>Dear MathGroup, I'd like to use Mathematica 4.0 to write a function
>having different expressions in different domain's intervals. Let's
>say:
>
>F[x_]=    x^2   if 0<x<6 x+1   if x>=6

Try

f[x_]:= x^2 /;  0<x<6
f[x_]:= x+1/; x>=6

The "/;" specfies a conditional rule. You can define a fuction with as many pieces as you like in this manner


  • Prev by Date: Decision tree analysis in Mathematica?
  • Next by Date: Re: Mathematica 4.2: Problem with online help.
  • Previous by thread: Decision tree analysis in Mathematica?
  • Next by thread: Re: Re: How to ...?