MathGroup Archive 2004

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

Search the Archive

Re: Vector Piecewise in 5.1


And it seems that pw cannot directly be plotted, not even by using, e.g.,

   Plot[cf, {x, -1, 1}];

after your definition of cf.


Mark Fisher wrote:
> To my surprise (and delight) it turns out that Piecewise in 5.1 can
> handle vectors (to some extent):
> 
> pw1 = Piecewise[{{x, x > 0}}]
> pw2 = Piecewise[{{x2, x > 0}}]
> 
> pw = PiecewiseExpand[{pw1, pw2}]
> 
> This can even be compiled successfully:
> 
> cf = Compile[{x}, Evaluate[pw]]
> 
> And differentiated:
> 
> D[pw, x]
> 
> But not, however, integrated:
> 
> Integrate[pw, x]
> 
> (Worse, Integrate[pw, {x, 0, 3}] returns a scalar.)
> Is this a bug or just the absence of an undocumented feature?
> 
> --Mark
> 
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: All Factors of a number
  • Next by Date: UnitStep bugs remain in ver. 5.01
  • Previous by thread: Vector Piecewise in 5.1
  • Next by thread: Re: Vector Piecewise in 5.1