Problem with mathematica - i am new to this

  • Context: Mathematica 
  • Thread starter Thread starter lavster
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around a problem encountered while using Mathematica to create a Manipulate graph with a dropdown menu as the controller type. Participants explore issues related to variable ranges and control types within the Manipulate function.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant describes an error message received when attempting to use a PopupMenu for a variable range in the Manipulate function, indicating that Mathematica does not support this configuration.
  • Another participant suggests removing the PopupMenu specification to default to sliders, which they assert will function correctly.
  • A different participant emphasizes the requirement for a dropdown menu specifically and expresses frustration with the simplicity of sliders.
  • There is a proposal to use a dropdown menu for one variable (n) and a slider for the other variable (l) as a potential compromise.
  • One participant shares a workaround involving nested Manipulates to achieve the desired dropdown functionality for both variables, although they acknowledge it may not be an elegant solution.

Areas of Agreement / Disagreement

Participants express differing views on how to implement the dropdown menu, with some advocating for sliders as a simpler alternative. The discussion remains unresolved regarding the best approach to meet the requirement for dropdown menus.

Contextual Notes

The discussion highlights limitations related to the compatibility of control types with variable specifications in Mathematica, as well as the participants' varying preferences for user interface elements.

lavster
Messages
213
Reaction score
0
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 doesn't 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 doesn't 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 I am not sure how to do this either...

thanks
 
Physics news on Phys.org


I would just delete the "ControlType->{PopupMenu}" specification. You will get sliders, but they will work just fine.
 


i was specifically asked to use the drop down menu. but i still can't get it. the sliders seem to make life a whole lot simpler...
 


Do you need a drop down menu for both, or could you use a drop down menu for n and a slider for l?
 


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}]
 


thanks so much for that!
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K