MathGroup Archive 2002

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

Search the Archive

Re: How to ...?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36329] Re: [mg36309] How to ...?
  • From: "milkcart" <milkcart at m17.alpha-net.ne.jp>
  • Date: Mon, 2 Sep 2002 04:08:36 -0400 (EDT)
  • References: <200208310525.BAA28658@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

You can use "If, Which, Condition"

f[x_] := If[0 <= x && x <= 6, x^2, x + 1];
g[x_] := 2*x^2 /; 0 <= x <= 6;
g[x_] := 2*x + 1 /; x > 6;
h[x_] := Which[0 <= x <= 6, 3*x^2, 6 < x, 3*x + 1]
Plot[{f[x], g[x], h[x]}, {x, 0, 10}]


> 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

*******************
milkcart
milkcart at m17.alpha-net.ne.jp
***********************




  • Prev by Date: RE: How to ...?
  • Next by Date: Re: PlotLabel
  • Previous by thread: RE: How to ...?
  • Next by thread: Re: How to ...?