       Re: Plotting questions

• To: mathgroup at smc.vnet.net
• Subject: [mg19979] Re: [mg19949] Plotting questions
• From: "David Park" <djmp at earthlink.net>
• Date: Thu, 23 Sep 1999 23:26:25 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```Michael Chang wrote:

>Hi again!
>
>Sorry, but in my rush, I sent out the *wrong* example regarding my plotting
>difficulties in an earlier email (about 1 hour ago) today.
>
>I *meant* to use the following example:
>
>Suppose
>
>x(t)=(10^(1-g)-(1-g)*t)^(1/(1-g))
>
>where 0.5<g<1 (say).
>
>I want to simulate this function x(t) for varying t ... specifically,
>
>0<=t<=10^(1-g)/(1-g)
>
>so that x(t) remains *real* for all t.  For t > t_f := 10^(1-g)/(1-g),
>
>define x(t)=0.
>
>What I'd like to do is get a parametric 3d *surface* plot with g, t as two
>axis, and x(t) as the third axis.  I've struggled with this for a while,
>but can't seem to do this using Plot3D (due to the fact that the range of
>values for t *cannot* be given as a function of g ... i.e. I must use
>
>{t,0,10} (say), and *not*
>{t,0,10^(1-g)/(1-g)}
>
>which is what I really want).
>
>I suspect that I have to change my definition of x(t) so that it knows
>that if t>t_f, then x(t) should be 0, so that I can then use a fixed
>plotrange for t, but I don't know how to do this ...
>
>Sorry for any confusion!
>
>Thanks again!
>
>Mike!
>

Michael,

There is a package at my web site called DrawingCube which contains a routine for
doing what you wish. I will show here the specific results of the routine and a
plotting statement for your function which you can plot without the package.

x[t_, g_] = (10^(1 - g) - (1 - g)*t)^(1/(1 - g));

This is a 3D parametric representation of your function which is necessary to produce
the plot you wish:

p[t_, g_] = {t, g, x[t, g]}
{t, g, (10^(1 - g) - (1 - g)*t)^(1/(1 - g))}

This is the routine in my package:

?IteratorSubstitution

"IteratorSubstitution[expr, {var, lim1, lim2}, newvar:w] is used to transform \
a plot range iterator, which may contain variable limits, to one which \
contains constant limits. The plotting expr is transformed to the new \
variable and returned along with the new iterator."

Using this on the parametric representation:

IteratorSubstitution[{t, g, (10^(1 - g) - (1 - g)*t)^(1/(1 - g))},
{t, 0, 10^(1 - g)/(1 - g)}]
{{-((10^(1 - g)*w)/(-1 + g)), g, (-10^(1 - g)*(-1 + w))^
(1/(1 - g))}, {w, 0, 1}}

We can now plot the new parametric representation using g and w as the plotting
parameters.
We actually need a slightly restricted range of g to obtain a nice looking plot.

ParametricPlot3D[{-((10^(1 - g)*w)/(-1 + g)), g,
(-10^(1 - g)*(-1 + w))^(1/(1 - g))}, {g, 0.5, 0.95}, {w, 0, 1},
BoxRatios -> {1, 1, 1}, AxesLabel -> {t, g, "x[t,g]"},
AxesEdge -> {{-1, -1}, {1, -1}, {-1, -1}},
FaceGrids -> {{0, 0, -1}, {-1, 0, 0}, {0, 1, 0}}];

Try this out and see if it is what you intended.

David Park