Re: Making plots using transformation rules
- To: mathgroup at smc.vnet.net
- Subject: [mg71938] Re: [mg71928] Making plots using transformation rules
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 5 Dec 2006 06:04:37 -0500 (EST)
- Reply-to: hanlonr at cox.net
Clear[g];
g[t_] = D[t^2,t];
g[1]
2
Plot[g[t],{t,0,1}];
Or
Clear[g];
g[t_]:=Evaluate[D[t^2,t]];
g[1]
2
Bob Hanlon
---- amannuc at yahoo.com wrote:
> 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
> following:
>
> 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.
>