Generate, and hold, a random data set

General discussion about Mathematica features and functionality...
Forum Rules
By using the Wolfram Faculty Program Forum, you agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, or sexually oriented material. Wolfram Faculty Program Forum administrators have the right to remove, edit, move or close any topic at any time should we see fit.

Personal Information: Posts in this forum may be viewed by non-members; however, the forum prohibits non-members from viewing your profile. Although your email address is hidden from both non-members and members, your account is initially configured to allow members to contact you via email through the forum. If you wish to hide your profile, or prohibit others from contacting you directly, you may change these settings by updating your profile through the User Control Panel.

Attachments: Attachments are not currently enabled on this forum. To share a file with others on this site, simply upload your file to the online storage service of your choice and include a link to the file within your post. If your school does not offer an online file storage and sharing service, the following sites provide free basic online file storage and sharing: Mozy, FilesAnywhere, Adrive, and KeepandShare.

Generate, and hold, a random data set

Postby Clifton_McInnis » Fri Feb 22, 2013 2:30 am

I am trying to have the program generate a random data set and display the data and a box-and-whisker, which it does, although not as neatly as I would like. I would additionally like to have the program ask the student a question, at times, and not at others (this if for use on a smart board). My problem is that when the question is displayed the program changes the data set. I wondered if anyone could tell me how to change the code so that the data set would remain that same when the program is prompted to display the question. Thank you for your consideration, and for any and all advice.
Clifton McInnis

Code: Select all
Needs["System`"]
Manipulate[data = RandomInteger[{min, max}, num];
If[showquestion,
   Style["The interquartile range is the range between the first and \
third quartile. What is the interquartile range for this data set?"],
   ""]
  Grid[{{Text@Style[Row[{"data = ", data}], "Label", 14]}}] Show[
   BoxWhiskerChart[data, BarOrigin -> Left],
   ImageSize -> Large], {{num, 11,
   "how many numbers are in the data set?"}, 11, 101, 10,
  Appearance -> "Labeled"}, {{min, 1,
   "What is the smallest possible value?"}, 1, 90, 1,
  Appearance -> "Labeled"}, {{max, 11,
   "What is the largest possible value?"}, 11, 100, 1,
  Appearance -> "Labeled"}, {{showquestion, False,
   "do you want to show the question?"}, {True, False}}]
User avatar
Clifton_McInnis
 
Posts: 2
Joined: Wed Jun 15, 2011 9:26 pm
Organization: Vicksburg-Warren School District
Department: Mathematics

Re: Generate, and hold, a random data set

Postby Clifton_McInnis » Sun Feb 24, 2013 7:50 pm

I certainly thank those who gave this problem a look and just wanted to let you know that I did come up with a solution of sorts, maybe not the best, but it works (you do have to press the button once to get the Box-and-Whisker). Still have a few issues with formatting that I wish were cleaned up a little. I did run across and area of concern where the program told me that the median of 1,2,3,4,5,11,12,13,14,15 was 5. At any rate here is the code that I used:
Code: Select all
Needs["System`"]
data := {1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15}

Manipulate[newdata = RandomInteger[{min, max}, num];
  If[showquestion,
   Style["The interquartile range is the range between the first and \
third quartile. What is the interquartile range for this data set?"],
   ""]
  Grid[{{Text@Style[Row[{"data = ", data}], "Label", 14]}}] Show[
   BoxWhiskerChart[data, BarOrigin -> Left], ImageSize -> Large],
Button["Change the data set?", data = newdata],
{{num, 11, "how many numbers are in the data set?"}, 11, 101, 10,
  Appearance -> "Labeled"}, {{min, 1,
   "What is the smallest possible value?"}, 1, 90, 1,
  Appearance -> "Labeled"}, {{max, 11,
   "What is the largest possible value?"}, 11, 100, 1,
  Appearance -> "Labeled"}, {{showquestion, False,
   "do you want to show the question?"}, {True, False}}]
User avatar
Clifton_McInnis
 
Posts: 2
Joined: Wed Jun 15, 2011 9:26 pm
Organization: Vicksburg-Warren School District
Department: Mathematics


Return to General Mathematica Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron