Build Your Own Conversion Tool

Go to your favorite web browser and type “unit converter.” You’ll see an in-browser app that looks similar to these and lets you select different types of measurements and the different units to convert between. Now you can play around with the different units and measurements.

Mathematica can convert between units using the function UnitConvert[]. e.g. UnitConvert[Quantity[8.2, “feet], “kilometres”] converts 8.2 feet into kilometres.

Examine the following code:

The ControlType and ControlPlacement codes can improve the interface.

  • Try to convert from millimeters to meters or from feet to centimeters.
  • Add options for oldUnit and newUnit so you can make these conversions.

Converting weight units:

  • Copy/paste your unit converter.
  • Change the options to the lists for oldUnit and newUnit to units of weight.

Currency converter:

  • Copy/paste your unit converter.
  • Change the new converter to units of “AUD” and “USD”
  • Look up the 3-letter codes for some other currencies and add these.

Then you can create an all-in-one converter by wrapping the individual converters together using a TabView[]:

A time zone converter is another useful conversion tool. Mathematica has a few useful functions to help with building one of these:

LocalTime[Paris(city)]
will give you the time right now in Paris. Use CTRL+= to get the box input =[Paris]

  • Build a converter to get the time in a number of different cities.
  • Add it as a new tab to your all-in-one converter

What about if you want to know what the time will be in Paris when it’s 5pm at your location?

  • Modify the existing time converter to accommodate this
    (Check out the function TimeZoneConvert[] to assist your thinking)

Where else could you go from here?

  • Areas, volumes, astronomical units, and more!

About the blogger:

Miles Ford

Miles Ford integrates Mathematica and the Wolfram Language into every aspect of his teaching of the Queensland and Australian mathematics curriculum. This includes using them to teach concepts through notebooks and interactive models, as well as student use of their computational power and programming potential across the learning and assessment spectrum. While primarily focused on the mathematics classroom, he also works with other teachers to take advantage of Mathematica’s power across the science, technology, and humanities fields.

Miles is the Head of Mathematics at St John’s Anglican College and has been using Mathematica since 2011, when he introduced it to his senior mathematics programs. Over the last few years, he has expanded its use throughout the mathematics department across all secondary school levels and into other curriculum areas. He particularly enjoys using the Wolfram Language to solve novel problems and helping students to develop their own solutions using Mathematica. Miles presented at the Australian Wolfram Technology Conference 2015 on the process of embedding Mathematica into the mathematics program.

--

--

Tech-Based Teaching Editor
Tech-Based Teaching: Computational Thinking in the Classroom

Tech-Based Teaching is all about computational thinking, edtech, and the ways that tech enriches learning. Want to contribute? Reach out to edutech@wolfram.com.