       Re: Draw two functions in a graph, one of them does also have a parameter.

• To: mathgroup at smc.vnet.net
• Subject: [mg90203] Re: Draw two functions in a graph, one of them does also have a parameter.
• Date: Wed, 2 Jul 2008 05:30:08 -0400 (EDT)
• References: <g4d2ut\$er8\$1@smc.vnet.net>

```Felipe Mannshardt wrote:
> Is there a way to do a Plot do draw this two functions in the same graph ?
> I am asking because i am having problems due the parameter  "a".
>
> I have,
>
> f(x)= -x^2 + 6x
> g(x)= ax
>
> i want to draw them in the same graphic and with a from 0 to 3 . . .
>
> Can not think of a way of doing this, due the "a" parameter . . .
>
> Plot[{f[x],[g[a][x]},{x,0,7},{a,0,3}]
>
>
> Can some help me out with this small issue ?
>
>
>
> In Latex,

[snip]

Please don't post Latex. Copy and paste Mathematica code in input form,
so that anybody can copy it back into Mathematica and evaluate it.

I'm not completely certain what values of a you would like to use (what
step size between values?), but here are a couple of possibilities.

f[x_] = -x^2 + 6 x;
g[a_][x_] = a x;
list = Flatten[{f[x], Table[g[a][x], {a, 0, 3, .2}]}];
Plot[list, {x, 0, 7}]

Or make it interactive:

f[x_] = -x^2 + 6 x;
g[a_][x_] = a x;
Manipulate[
Plot[{f[x], g[a][x]}, {x, 0, 7}, PlotRange -> {-10, 20}], {a, 0,
3, .05, Appearance -> "Labeled"}]

--