Metric Measurement Units

Madiha Baloch
mbaloch100@qc.cuny.edu
Math 213 -- Mathematics with Mathematica, Fall 2009 
December 3, 2009

Abstract

The main purpose of this project is to understand the concept of “Units” in mathematica. This project illustrates that how mathematica can be used to play game called Metric Measurement Units, which is about placing the Units in the increasing order. In addition to this, I’ll show how mathematica will determine that whether the player is right or wrong. Through this project, I came across with so many different and new commands and functions, like griding the sliders, value generating function, manipulating the units etc.The more important and interesting command I learned doing this project was the Units command, a command which loads the Units from the units package.

Section 1. Introduction

1.1 Background

Choosing a unique topic in mathematica related to the games was quite hard, since the mathematica already has huge collection of educational, interesting and entertaining games. However, examining some impartial games with mathematica and other websites, I came up with game called “metric measurement units”. Hence,the basic idea of this project is from the game called "Caterpillar", which was about to place the units into the segments of the Caterpillar in growing order. After playing that game,I noticed that playing measurement units with mathematica could be really interesting topic for my project.

1.2 Problem Statement

The Problem Statement I answer is: 
"How mathematica can be used to play game called Metric Measurement Units".

1.3 Useful Commands

The useful commands for this project are;
Units`: loads the units package.
Random Sample: gives the random number from the list.
ValueGenerator: generates the value from the multiplication of the random sample.
/.: it replaces the units with decimals like 10^2.
Ordering: It gives the position in list at which each successsive element of list apppears.
Grid: generates the combination of sliders, each works independently.
dynamic slider: A slider with its value updated dynamically.
Manipulation: The most important command to run this project, putting all the commands together to run the project.

1.4 File Structure

In Section 2, I investigated the Units Package by loading the Units` and then I replaced the Units (length) with decimals and defined it as compare function. After replacing the values, I multiplied the random sample of list from 1 to 6 with the random sample of units and named it as value generator, it generates the different value each time by clicking on it. The value generator is then named as VV,WW,XX,YY,ZZ, so it creates the random value for each variable. At last, in manipulate command, I manipulated the sliders and named them as A,B,D,F,G,H. and by using the ordering command, I made each A,B,D,F,G,H equal to VV,WW,XX,YY,ZZ to get more accurate result.
In section3, this project is based on linear measure and can be created in different ways too.

Section 2. Main Work

2.1 Investigating Units`

It appears that it would be a good idea to load the units package first.

<<Units`

Compare[value_]:=(*defines each Unit in decimals*)First[value]/.{Centi-> 10^(-2),Deci->10^(-1),Meter->1,Deca->10,Hecto->100,Kilo->1000}

2.2 Generating the random sample

ValueGenerator[]:=RandomSample[{1,2,3,4,5,6},1]*RandomSample[{1,10,100},1]*RandomSample[{Centi Meter,Deci Meter,Meter,Deca Meter,Hecto Meter,Kilo Meter},1];(* generates the value by multiplying each random sample*)

ValueGenerator[]

2.3 Manipulating the Random Samples

Now I manipulted the slides named A,B,E,F,G,H and by ordering command, i made each variable equal to value generator VV,WW,XX,YY,ZZ.

VV=ValueGenerator[];WW=ValueGenerator[];XX=ValueGenerator[];YY=ValueGenerator[];ZZ=ValueGenerator[];
Manipulate[Grid[{{VV,Slider[Dynamic[A],{1,5,1}],Dynamic[A]},{WW,Slider[Dynamic[B],{1,5,1}],Dynamic[B]},{XX,Slider[Dynamic[F],{1,5,1}],Dynamic[F]},{YY,Slider[Dynamic[G],{1,5,1}],Dynamic[G]},{ZZ,Slider[Dynamic[H],{1,5,1}],Dynamic[H]},{If[Ordering[{Compare[VV],Compare[WW],Compare[XX],Compare[YY],Compare[ZZ]}]==Ordering[{A,B,F,G,H}],"You got it!!!","Sorry, try again!"]}}],Dynamic[Style["LINEAR MEASURE","Title", Purple,FontSize->15]]](* get diffferent values by clicking on  manipulation*)

Section 3. Conclusion and Future Work

3.1 Summary

This project illustrates the length units, and the mathematica easily computes that which Unit is greater or lesser.

3.2 Discussion

There are various ways to do this project and can be created by choosing more units like capacity, length etc.

3.3 Future Work

If I had more time, I would investigate both units together like capacity, linear. I would put choices of playing it, like 6 or 7 sliders etc.

Section 4. References

Professor Christopher Hanusa, Queens College 
http://bbhosted.cuny.edu/webapps/portal/frameset.jsp?tab_id=_2_1&url=/webapps/blackboard/execute/launcher%3ftype%3dCourse%26id%3d_217217_1%26url%3d