MathGroup Archive 2006

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

Search the Archive

RE: Making plots using transformation rules

  • To: mathgroup at
  • Subject: [mg71951] RE: [mg71928] Making plots using transformation rules
  • From: "David Park" <djmp at>
  • Date: Tue, 5 Dec 2006 06:04:56 -0500 (EST)

Why do you use a SetDelayed instead of a simple Set?

g[t_] = D[t^2, t]
2 t

Plot[g[t], {t, 0, 10}];

Or if you had some more complicated function with parameters you might
define it with subvalue parameters as follows:

f[a_, b_][t_] = D[a  t^3 + b Sin[t], t]
3*a*t^2 + b*Cos[t]

Plot[f[2, 300][t], {t, 0, 10}];

Or you could even use

h[a_, b_][t_] := a  t^3 + b Sin[t]

Plot[h[2, 300]'[t], {t, 0, 10}];

It is generally worthwhile to have a function that is going to be plotted
well defined before plugging it into a Plot command - as opposed to doing a
lot of processing within the Plot command.

David Park
djmp at

From: amannuc at [mailto:amannuc at]

I've read about making plots of functions, for example:

Plot[Evaluate[f[x]], {x, 0, 10}]

I don't have this sort of function to plot. Because it involves
derivatives, I only get numerical output after defining a
transformation rule. A simple example (not the real one) is the

g[t_] := D[t^2, t]
g[t] /. t -> 1

I cannot evaluate g[1], because then Mathematica thinks I am trying to
take a derivative with respect to the number 1, and flags that as
error. So I need the transformation rule to get function values.

What is the best way to plot g[t]? I am looking to create multiple
transformation rules that replace the argument t with a reasonable
range of values. Then I can plot g[t] versus t. Plot will not do this
directly because it takes variable values as input. However, as I've
said, the construction g[x] (x = some number) flags an error.

Thanks for your help.

  • Prev by Date: Re: Drawing function with 3 variables in a graph
  • Next by Date: Re: (revision) NIntegrate that upper limit is infinite
  • Previous by thread: Re: Making plots using transformation rules
  • Next by thread: Re: Making plots using transformation rules