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: [mg93801] Re: How to convert a HeavisideTheta to a PieceWise function
  • From: "Kevin J. McCann" <Kevin.McCann at umbc.edu>
  • Date: Wed, 26 Nov 2008 05:13:06 -0500 (EST)
  • Organization: University System of Maryland
  • References: <gggqf5$317$1@smc.vnet.net>

How about this. I replaced HeavisideTheta with heavisideTheta, and
defined this with a Piecewise.

heavisideTheta[x_] = Piecewise[{{0, x < 0}, {1, x >= 0}}];
f[x_] = (x + (-2 + x) heavisideTheta[-2 + x] -
      2 (-1 + x) heavisideTheta[-1 + x]) heavisideTheta[x] // Simplify

The result for f[x] is
\[Piecewise]2-x    1<=x<2
x    0<=x<1
0    True

I am not sure about the "True" bit, but this plots correctly.

Kevin

wxziwyz at 126.com wrote:
> 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?
>




wxziwyz at 126.com wrote:
> 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: Re: Mathematica 7.0 slow on OS X
  • Next by Date: Re: Re: Creating a Banner -> Now creating a slide show
  • Previous by thread: Re: How to convert a HeavisideTheta to a PieceWise function
  • Next by thread: Using Alt or Cmd Keys to Enter Cell Types