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: [mg36343] Re: [mg36309] How to ...?
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Mon, 2 Sep 2002 04:08:54 -0400 (EDT)
  • References: <200208310525.BAA28658@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Use Condition (/;):

In[1]:=
f[x_] := x^2 /; 0 < x < 6;
f[x_] := x + 1 /; 6 <= x;
Plot[f[x], {x, 0, 10}];

Avoid using capital initial letters for your definitions: they are usually
reserved for in-built functions in Mathematica.

Tomas Garza
Mexico City

----- Original Message -----
From: "Paskoski" <berlusconi_pagliusi at fis.unical.it>
To: mathgroup at smc.vnet.net
Subject: [mg36343] [mg36309] How to ...?


> 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
>
> I know It's a stupid syntax problem, but I really do not know how/where to
> search the solution on the Mathematica Book
>
> Thank you in advance,
>
> PasKo.
>
>
>
>




  • Prev by Date: Input[] variable names into Mathematica
  • Next by Date: Re: PlotLabel
  • Previous by thread: Re: How to ...?
  • Next by thread: Re: How to ...?