Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Problem with mathematica - i am new to this

  1. Dec 8, 2009 #1
    problem with mathematica - i am new to this!!

    hi,

    im trying to produce a manipulate graph where the controller type is the drop down menu. (or pop up menu). However, mathematica doesnt seem to like the range of my variables.

    I have typed the following into mathematica:

    Manipulate[ Plot[r^2 p[n, l, r], {r, 0, 30}, ColorFunction -> "RoseColors", PlotRange -> All,
    PlotStyle -> {Thickness[0.008]}, AxesLabel -> {"r(a)", "probability"}], {n, 1, 4, 1}, {l, 0, n - 1, 1}, ControlType -> {PopupMenu}]

    (where p is my predefined function that depends on n, l, r).

    The error message is as follows:

    "Manipulate::vstype: ControlType -> PopupMenu is not supported for the variable specification {l$$,0,n$$-1}. ControlType -> Manipulator will be used instead."

    suggesting that it doesnt like my upper bound.

    How can i get around this? is there a command i can use? i vaguely recall other ppl using the table function within the manipulate function but im not sure how to do this either...

    thanks
     
  2. jcsd
  3. Dec 9, 2009 #2

    Dale

    Staff: Mentor

    Re: problem with mathematica - i am new to this!!

    I would just delete the "ControlType->{PopupMenu}" specification. You will get sliders, but they will work just fine.
     
  4. Dec 9, 2009 #3
    Re: problem with mathematica - i am new to this!!

    i was specifically asked to use the drop down menu. but i still cant get it. the sliders seem to make life a whole lot simpler...
     
  5. Dec 9, 2009 #4

    Dale

    Staff: Mentor

    Re: problem with mathematica - i am new to this!!

    Do you need a drop down menu for both, or could you use a drop down menu for n and a slider for l?
     
  6. Dec 9, 2009 #5

    Dale

    Staff: Mentor

    Re: problem with mathematica - i am new to this!!

    It is not very elegant, but I got this to work using nested Manipulates:

    Manipulate[
    Manipulate[
    Plot[r^2 p[n, l, r], {r, 0, 30}, ColorFunction -> "RoseColors",
    PlotRange -> All, PlotStyle -> {Thickness[0.008]},
    AxesLabel -> {"r(a)", "probability"}], {l, 0, n - 1, 1},
    ControlType -> {PopupMenu}], {n, 1, 4, 1},
    ControlType -> {PopupMenu}]
     
  7. Dec 12, 2009 #6
    Re: problem with mathematica - i am new to this!!

    thanks so much for that!!!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Problem with mathematica - i am new to this
  1. Mathematica problems (Replies: 2)

  2. Mathematica Problem (Replies: 3)

  3. Mathematica problem (Replies: 4)

  4. Mathematica problem (Replies: 2)

Loading...