MathGroup Archive 2009

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

Search the Archive

Plotting a table of piecewise functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105389] Plotting a table of piecewise functions
  • From: michael partensky <partensky at gmail.com>
  • Date: Tue, 1 Dec 2009 04:12:17 -0500 (EST)

Hi!
I have a table of three piecewise functions:

pdf[x]= {\[Piecewise] {
   {(x^2/9), 0 <= x <= 3},
   {0, \!\(\*
      TagBox["True",
       "PiecewiseDefault",
       AutoDelete->False,
       DeletionWarning->True]\)}
  }, \[Piecewise] {
   {0.25 x, 0 < x < 2},
   {0.5, 2 <= x < 3},
   {0, \!\(\*
      TagBox["True",
       "PiecewiseDefault",
       AutoDelete->False,
       DeletionWarning->True]\)}
  }, \[Piecewise] {
   {((4 x Cos[x]^2)/\[Pi]^2), 0 < x < \[Pi]},
   {0, \!\(\*
      TagBox["True",
       "PiecewiseDefault",
       AutoDelete->False,
       DeletionWarning->True]\)}
  }}

I would like to make a plot of it.

Plot[pdf[x],{x,-1,4},PlotStyle->{Red,Green,Blue}] ignores the colors and
interrupts some of the curves .


Plot[{pdf[x][[1]],pdf[x][[2]],pdf[x][[3]]},{x,-1,4},PlotStyle->{Red,Green,Blue}]
does the job as expected.

Why are the results different? What is wrong with the first approach?

Thanks.
Michael.



  • Prev by Date: Experimental`$EqualTolerance
  • Next by Date: Re: Simple Spreadsheet within Mathematica?
  • Previous by thread: Re: Re: Experimental`$EqualTolerance
  • Next by thread: Re: Plotting a table of piecewise functions