# Doing It by the Numbers: Javascript Calculations in Web-Based Instructional Material

## Page 1

The building of the web-based physics exploration environment which I call HyperPhysics was undertaken originally to provide a continuing resource for the science teachers which I have taught at Georgia State University. It has had a much wider impact than that, with over two million hits for the year 2000 through July. From the beginning, part of the strategy of that exploration environment was to lead users finally to a quantitative application of the concepts; a place where they could plug in the numbers and explore the results.

Given its original target audience, the design has been to approach any subject with illustration and qualitative discussion first, with links provided for a deeper exploration which includes the mathematics and finally an active routine in which the user could explore the concept numerically. Toward that numerical end, Javascript has proved to be an essential tool. Javascript is by all accounts a messy, unstructured language which has no graphical capability, but it has the very powerful characteristic of functioning smoothly over the web. You can post a Javascript routine for solving a specific problem on the web, and know that anywhere in the world a user can numerically solve the problem on their own computer. This is a very powerful teaching resource. I will give a number of examples of the use of Javascript in specific physical contexts.

To start with the simplest kind of application, here is an application to the concept of weight. The strategy here is simply one of illustration and a set of input/output boxes. The Javascript routines are initiated by simply entering a number in one of the boxes; the calculation is initiated by an "onchange()" command and will calculate the consistent values and place them in the other boxes. This illustrates one of the strategies used in the Javascript calculations, that of providing both the input and output in various unit systems. That has raised protests from SI purists, but in the U.S. we are still struggling to get our introductory students into SI, and I believe the instant visible display of the comparisons of the SI with US common units can help them make the transition.

mass.html#wgt