MathGroup Archive 2007

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

Search the Archive

Re: novice needs help using Manipulate with Plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78508] Re: novice needs help using Manipulate with Plot
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 3 Jul 2007 05:32:49 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <f68458$eoh$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

test := m x
Manipulate[
  Dynamic@ Plot[ test, {x, 0, 10}, Evaluated -> True], {{m, 1}, 0, 2},
  LocalizeVariables -> False]

will work, even when it is not a good programming style.

Regards
   Jens

PHILLMAN5 at gmail.com wrote:
> Manipulate seems at first to be very powerful, but I am having trouble
> using it with my own functions.  To vastly simplify my problem say I
> want to plot y = m x, with x going from 0 to 10, with the slider in
> Manipulate controlling m.  I have tried the following:
> 
> test := m x
> Manipulate[Plot[test, {x, 0, 10}], {{m, 1}, 0, 2}]
> 
> test3[x_] := m x;
> Manipulate[Plot[test3[x], {x, 0, 10}], {{m, 1}, 0, 2}]
> 
> don't seem to work.  If you define the function with m as a formal
> parameter, like the following it does.
> 
> test2 = #1 #2 &;
> Manipulate[Plot[test2[m , x], {x, 0, 10}], {{m, 1}, 0, 2}]
> 
> test4[m_, x_] := m x;
> Manipulate[Plot[test4[m, x], {x, 0, 10}], {{m, 1}, 0, 2}]
> 
> Is there anyway to write functions to work with Manipulate without
> have to have all the slider(s) formally written as a parameter to the
> function?
> 
> 


  • Prev by Date: Re: Show and PlotRange
  • Next by Date: Re: Show and PlotRange
  • Previous by thread: Re: novice needs help using Manipulate with Plot
  • Next by thread: Re: Maximize with Integer constraints