[Date Index]
[Thread Index]
[Author Index]
Asking PlotRange to take a Dynamic value
*To*: mathgroup at smc.vnet.net
*Subject*: [mg97951] Asking PlotRange to take a Dynamic value
*From*: Andrew <dr.a.graham at googlemail.com>
*Date*: Thu, 26 Mar 2009 05:23:20 -0500 (EST)
Hello,
I apologise in advance for what is probably a stupid question, but I
would appreciate some help in persuading PlotRange to take a Dynamic
value - or suggesting another way to go about things entirely!
For teaching purposes I wanted to draw a series of graphs of Log[x]
vs. x^a for small positive values of a at different scales (simply to
illustrate how Log[x] is eventually < x^a, for any positive a). I
thought I would use Manipulate to allow students to explore this
interactively.
E.g for x=0 to 10:
Manipulate[
Plot[{Log[x], x^0.2, x^0.25, x^0.3}, {x, 0.001, n},
PlotStyle -> {Red, Blue, Blue, Blue},
PlotRange -> {{0, 10}, {0, 3}}],
Style["Log[x] vs. \!\(\*SuperscriptBox[\"x\", \"a\"]\) for small \
positive a 0.2, 0.25 & 0.3", 12, Bold],
Style["x = 0 to 10", 12, Bold], {n, 0.01, 10,
Appearance -> "Labeled"}]
& for x=0 to 500,000:
Manipulate[
Plot[{Log[x], x^0.2, x^0.25, x^0.3}, {x, 0.001, n},
PlotStyle -> {Red, Blue, Blue, Blue},
PlotRange -> {{0, 500000}, {0, 55}}],
Style["Log[x] vs. \!\(\*SuperscriptBox[\"x\", \"a\"]\) for small \
positive a 0.2, 0.25 & 0.3", 12, Bold],
Style["x = 0 to 500,000", 12, Bold], {n, 0.01, 500000,
Appearance -> "Labeled"}]
But rather than a series of separate graphs I thought it would be more
elegant to combine them in one plot with a Dynamic value to choose the
scale, e.g.:
Manipulate[
Plot[{Log[x], x^0.2, x^0.25, x^0.3}, {x, 0.01, n},
PlotStyle -> {Red, Blue, Blue, Blue},
PlotRange -> {{1, Dynamic[z]}, {0, 55}}],
Style["Log[x] vs. \!\(\*SuperscriptBox[\"x\", \"a\"]\) for small \
positive a 0.2, 0.25 & 0.3", 12, Bold],
Row[{Style["x", Bold], " from 1 to ",
PopupMenu[Dynamic[z], {10, 500, 10000, 500000}]}], {n, 0.1,
Dynamic[z], Appearance -> "Labeled"}]
Unfortunately, although the graphs will plot, with continually
updating axes, what I really want is to change the plot range for each
value of x & fix it so one can see the curves evolving more easily. I
hope the 2 individual examples above make it clear what I hoped for -
essentially, to click from one to the next with the PopupMenu. The
error message reads (e.g. for x=10):
Plot::prng: Value of option PlotRange -> {{1,10},{0,55}} is not All,
Full, Automatic, a positive machine number, or an appropriate list of
range specifications. >>
What's gone wrong? PlotRange -> {{1,10},{0,55}} looks like "an
appropriate list of range specifications" to me!
Any advice appreciated
Best regards
Andrew Graham
Prev by Date:
**Re: solving nonlinear simultaneous equations**
Next by Date:
**Re: Re: Unexpected behavior of Floor and IntegerPart**
Previous by thread:
**Re: What's going on here (Table-generated lists)?**
Next by thread:
**Re: Asking PlotRange to take a Dynamic value**
| |