Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: How to convert a HeavisideTheta to a PieceWise function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93803] Re: How to convert a HeavisideTheta to a PieceWise function
  • From: "Steve Luttrell" <steve at _removemefirst_luttrell.org.uk>
  • Date: Wed, 26 Nov 2008 05:13:28 -0500 (EST)
  • References: <gggqf5$317$1@smc.vnet.net>

Try this:

f[x_]:=(x+(-2+x) HeavisideTheta[-2+x]-2 (-1+x) HeavisideTheta[-1+x]) 
HeavisideTheta[x]

PiecewiseExpand[f[x]/.HeavisideTheta->UnitStep]

which gives (in InputForm)

Piecewise[{{2 - x, Inequality[1, LessEqual, x, Less, 2]},
     {x, Inequality[0, LessEqual, x, Less, 1]}}]

You need to make the replacement HeavisideTheta->UnitStep because 
PiecewiseExpand doesn't know about HeavisideTheta.

-- 
Stephen Luttrell
West Malvern, UK

"wxziwyz at 126.com" <wangxz1983 at gmail.com> wrote in message 
news:gggqf5$317$1 at smc.vnet.net...
> For example:
> we have f(x) = (x + (-2 + x) HeavisideTheta[-2 + x] -  2 (-1 + x)
> HeavisideTheta[-1 + x]) HeavisideTheta[x]
>
> apparently, this is a piecewise function.
>
> My problem is, How to transfer it into a Piecewise expression, i.e.
>
> f(x) = Piecewise[{{0, x < 0}, {x, 0 < x <= 1}, {2- x, 1 < x <= 2}, {0,
> x > 2}}]
>
> Is there any function in Mathematica can do this?
> 



  • Prev by Date: Re: Mathematica 7.0 slow on OS X
  • Next by Date: Re: financial chart with volumes
  • Previous by thread: Re: How to convert a HeavisideTheta to a PieceWise function
  • Next by thread: Re: How to convert a HeavisideTheta to a PieceWise function