Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90218] Re: Draw two functions in a graph, one of them does also have a parameter.
  • From: "David Park" <djmpark at comcast.net>
  • Date: Wed, 2 Jul 2008 05:32:57 -0400 (EDT)
  • References: <g4d2ut$er8$1@smc.vnet.net>

With the Presentations package I would do it this way.

Needs["Presentations`Master`"]

f[x_] := -x^2 + 6 x
g[a_][x_] := a x

Draw2D[
 {Draw[f[x], {x, 0, 7}],
  Table[Draw[g[a][x], {x, 0, 7}], {a, 0, 3}]},
 AspectRatio -> 1,
 Frame -> True,
 ImageSize -> 400]

If you want to label the lines with a parameter you could use:

Module[{h},
 h = Table[Draw[g[a][x], {x, 0, 7}], {a, 0, 3}];
 Draw2D[
  {Draw[f[x], {x, 0, 7}],
   h,
   h // DrawLineLabels[#2/#1 &, .6 &, .1, {0, 1, 2, 3},
     Style[#, 14] &,
     DrawLLTextOptions -> {Background -> White}]},
  AspectRatio -> 1,
  Frame -> True,
  ImageSize -> 400]]


-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/


"Felipe Mannshardt" <vexie.infamous at googlemail.com> wrote in message 
news:g4d2ut$er8$1 at smc.vnet.net...
> 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,
>
>
>
> \text{Clear}[x,f,g]
>
> f[\text{x$\_$}]\text{:=}-x^2+6x
>
> \text{Nullstellen} \text{von} f[x]
>
>
>
> \text{Solve}[f[x]==0,x]
>
> \{\{x\to 0\},\{x\to 6\}\}
>
> \text{Fl{\" a}che} \text{von} f[x]
>
>
>
> \int_0^6 f[x] \, dx
>
> 36
>
> \text{Clear}[x]
>
> g[\text{a$\_$}][\text{x$\_$}]\text{:=}a*x
>
> \text{Graphisch} \text{dargestellt}
>
>
>
> \text{Plot}[f[x],\{x,-0.2,6.2\}]
>
>
>
> \text{Plot}[\text{Table}[g[a][x],\{a,0,3\}],\{x,0,2\}]
>
>
>
>
>
>
>
> 



  • Prev by Date: Re: Draw two functions in a graph, one of them does also have a parameter.
  • Next by Date: Re: On the built-in function "Compile"
  • Previous by thread: Re: Draw two functions in a graph, one of them does also have a parameter.
  • Next by thread: Re: Draw two functions in a graph, one of them does also have a parameter.