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.
- Follow-Ups:
- Re: Plotting a table of piecewise functions
- From: michael partensky <partensky@gmail.com>
- Re: Plotting a table of piecewise functions