Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*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 2000

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

Search the Archive

Re: Piecewise functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23498] Re: [mg23119] Piecewise functions
  • From: "Flumpy" <Flumpy at microsoft.com>
  • Date: Sun, 14 May 2000 17:00:01 -0400 (EDT)
  • Organization: MindSpring Enterprises
  • References: <8e0m31$f0p@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I have a pair of mittens.
Can you say, "Kitty" ?

<Matt.Johnson at autolivasp.com> wrote in message
news:8e0m31$f0p at smc.vnet.net...
>
>
> An-
>
> You can define a piecewise function by use of UnitStep[x]...
>
> Suppose I have 3 functions:
>
> x^2 for x<=0
> x for 0<=x<=10
> -x+20 for x>=10
>
> Then they can be defined with UnitStep[]:
>
> fun1[x_] := x^2*UnitStep[-x];
> fun2[x_] := x*(UnitStep[x] - UnitStep[x - 10]);
> fun3[x_] := (-x+20)*UnitStep[x - 10];
>
> Then, we can combine these into one function and plot to check it:
>
> fun[x_] := fun1[x] + fun2[x] + fun3[x];
> Plot[fun[x], {x, \(-10\), 20}];
>
> The UnitStep function also allows integration:
>
> In[31]:=
> Integrate[fun[x], x]
>
> Out[31]=
> x^3/3 + 20(-10 + x) UnitStep[-10 + x] -
>     2(-50 + x^2/2) UnitStep[-10 + x] +
>     1/2 x^2 UnitStep[x] - 1/3 x^3 UnitStep[x]
>
> -matt
>
>
>
>
>
> An Le <an_le at brown.edu> on 04/19/2000 12:30:49 AM
>
> Subject: [mg23498]  [mg23119] Piecewise functions
>
>
>
>
> Can someone send me some notebook and package files to do piecewise
> functions? I can't seem to be able to do it with mathematica.
>
> The only thing i get close to is using the Which[] function, but I can't
> integrate with that function.
>
> Thanks...
>
>
>
>
>
>
>




  • Prev by Date: Re: approximation by rationals
  • Next by Date: Re: approximation by rationals
  • Previous by thread: Re: Slow system reaction
  • Next by thread: Parametric Solving Question From 14 Year Old