Message Boards Message Boards

Create a Manipulate with the following slider?


Hi Below are two examples of using manipulate.

Manipulate[Range[n], {n, 1, 5, 1}]

Will give a slider with a set ie. {1} ... {1,2}...{1,2,3}....etc


Manipulate[Range[n], {n, 1, 5, 0.1}]

Does not give {1} ... {1,1.1}... {1,1.1,1.2}...{1,1.1,1.2,1.3}


6 months ago

You must look at the description of Range[] function:

    Range[Subscript[i, max]]
generates the list {1,2,\[Ellipsis],Subscript[i, max]}. 

    Range[Subscript[i, min],Subscript[i, max]]
generates the list {Subscript[i, min],\[Ellipsis],Subscript[i, max]}. 

    Range[Subscript[i, min],Subscript[i, max],di] 
uses step di.

So, your code must be modified, e.g., in such a manner:

Manipulate[Range[1, n, 0.1], {n, 1, 5, 0.1}]
POSTED BY: Valeriu Ungureanu
6 months ago

Greetings Valeriu,

Thanks for providing the explanation. I have made a notebook example with your explanation for future reference. i do appreciate the help.

Kind Regards,


6 months ago

I have a follow up question. I have tried:

Range[Subscript[i, min],Subscript[i, max]]

Range[Subscript[1, 10], Subscript[1, 20]]

I get

Range::range: Range specification in Range[Subscript[1, 10],Subscript[1, 20]] does not have appropriate bounds.

Followed by Range [1Sub10, 1Sub20]

6 months ago

Let us look in the documentation once again:

enter image description here

The meaning of each item may be understood better knowing that $i_{min}$ means the minimal possible value in the range, and $i_{max}$ means the maximal possible value. So, I can exemplify that items in three simple examples:

In[1]:= Range[14]

Out[1]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}

In[2]:= Range[7, 14]

Out[2]= {7, 8, 9, 10, 11, 12, 13, 14}

In[3]:= Range[7, 14, 2]

Out[3]= {7, 9, 11, 13}

Good luck for you!

POSTED BY: Valeriu Ungureanu
6 months ago


6 months ago

Group Abstract Group Abstract