Problem with mathematica - i am new to this

  • Mathematica
  • Thread starter lavster
  • Start date
  • Tags
    Mathematica
In summary, the conversation discusses a problem with creating a manipulate graph in Mathematica using a drop down menu. The error message suggests that the upper bound is not supported. The solution is to use sliders instead of a drop down menu. However, the person was specifically asked to use a drop down menu and is unsure of how to do so. The expert suggests using nested Manipulate functions, with a drop down menu for n and a slider for l.
  • #1
lavster
217
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
  • #2


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


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...
 
  • #4


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


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}]
 
  • #6


thanks so much for that!
 

1. What is Mathematica and how does it work?

Mathematica is a software program used for mathematical and scientific computations. It is based on the Wolfram Language and can perform a wide range of calculations, visualizations, and data analysis. It uses a combination of text-based commands and interactive tools to input, manipulate, and output mathematical expressions.

2. What are some common problems people face when using Mathematica for the first time?

Some common problems people face when first using Mathematica include difficulty understanding the syntax and structure of the Wolfram Language, difficulty importing and exporting data, and difficulty visualizing and formatting output. It can also be overwhelming to learn all of the built-in functions and features of Mathematica.

3. How can I troubleshoot errors or unexpected behavior in Mathematica?

The first step to troubleshooting errors in Mathematica is to carefully review the input you have entered and make sure it is correct. You can also use the documentation and online resources to learn more about specific functions and their correct usage. If you are still experiencing issues, you can seek help from online forums or reach out to the Mathematica support team.

4. What are some tips for beginners using Mathematica?

Some tips for beginners using Mathematica include practicing with simple examples to get familiar with the syntax and structure of the Wolfram Language, using the built-in documentation and online resources for help, and breaking down complex problems into smaller, manageable steps. It can also be helpful to save your work regularly and use meaningful variable names to keep track of your calculations.

5. Can Mathematica be used for more than just math and science?

Yes, Mathematica can be used for a variety of purposes beyond math and science. It has features for data analysis, image processing, and even creating interactive documents and presentations. It can also be used for programming and creating simulations. It is a versatile software that can be applied to many different fields and industries.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
261
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
934
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Back
Top