Re: Manipulate piecewise functions,
- To: mathgroup at smc.vnet.net
- Subject: [mg107661] Re: [mg107643] Manipulate piecewise functions,
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 22 Feb 2010 03:08:55 -0500 (EST)
- Reply-to: hanlonr at cox.net
If you plot all of the curves on a single plot they will overlap and make it difficult to see what is happening.
Recommend an array of plots.
Manipulate[
Grid[
Partition[
Table[
Plot[
Piecewise[{
{x - p, x < a + p},
{(x - p)^2, x >= a + p}}],
{x, -8, 5},
Frame -> True,
Axes -> False,
PlotRange -> {-10, 50},
ImageSize -> 250,
Epilog ->
{Style[
Text[
"a = " <> ToString[a],
{-6, 40}],
Blue, 16],
Style[
Text[
"step = " <> ToString[a (a - 1)],
{-6, 30}],
Blue, 16]}],
{a, 6}],
2]],
{p, -6, -2, Appearance -> "Labeled"}]
Bob Hanlon
---- Vedhas | sahdeV <vedhas at gmail.com> wrote:
=============
a = {1 2 3 4 5 6}
The goal is to plot a piecewise function corresponding to each of "a"
values, with manipulate where control variable is p, and the function
for plot y versus x is:
y=x-p for x-p<a, and (x-p)^2 for (x-p)>=a i.e. 6 plots getting
manipulated simultaneously.
I am new to Mathematica and this might be a naive question, but I
couldn't find a solution through help documentation. I will appreciate
if you can help!
Thanks,
Vedhas