Newton 2.7

Author: Thomas A. Moore

Date: August 2007

This program automates the construction of two-dimensional trajectory diagrams. Constructing a trajectory diagram is a graphical technique for numerically integrating Newton's second law. This technique is discussed in chapter N4 of the Unit N text in the Six Ideas That Shaped Physics series of introductory texts (2nd edition, McGraw-Hill, 2003). The technique allows you to predict the trajectory for any object if you know its vector acceleration as a function time or the object's position or velocity.

Setting Up a Situation

To set up a model situation, press the "Setup" button. This will display a dialog where you can specify the time step (and units), the object's initial position vector (and units), its initial velocity vector, and its acceleration vector. You can choose whether the plane of motion is the xy or xz plane, and you can also choose whether to specify the initial velocity in terms of components or as a magnitude and an angle from the x axis. The acceleration is the sum of five possible terms, one in the +x direction, one in the +y (or +z) direction, one in the direction pointing radially away from the object's current position, one pointing "forward" (in the direction of the object's current velocity), and one pointing "sideward" (in the direction perpendicular to the object's current velocity that would be to the left of a person standing in the plane of the motion and looking forward as defined by the velocity. (This last direction is useful for modeling lift forces and magnetic forces.) The numerical value of each of these terms is specified by a mathematical expression that can depend on x, y, z, t, r (the current distance between the object and the origin), v (the object's current speed), and vx, vy, vz (the components of the object's current velocity). See the bottom of these notes for more information about how to format the mathematical expressions.  Note also that you can use the "Cases" menu to quickly set up one of a number of interesting physical cases.

Generating the Trajectory Diagram

Once you have dismissed the "Setup" dialog, you will see the initial velocity vector displayed on the graph. Pressing the "Step" + button tells the computer to construct the next step of the trajectory diagram. The "Do 5,"Do 20," and "Do 100" buttons execute 5, 20, and 100 such steps. The "Go Slow" button causes the program to execute a step every half-second until the user presses the same button again. The "Reset" button restores the graph to the specified initial conditions. You can use the checkboxes below and to the right of the graph to specify whether the drawing should display velocity vectors, acceleration vectors, only the last step (as opposed to all steps), and/or numbers beside every fifth position point. The displayed numbers in the latter case specify the number of time steps since t = 0.


Zooming In and Changing Axis Limits

You can zoom in on a particular area of the graph by dragging the mouse over the region of interest. A gray rectangle will indicate the region currently selected for enlargement. Releasing the mouse button will then display a close-up of the selected area. To return to displaying the entire graph, simply click anywhere in the graph or press any of the step buttons. If you hold down the command (cloverleaf) button, you can drag the graph (effectively changing the axis limits).


Select the "Print" option under the File menu to print the graph. The program will present you with a dialog hat will prompt you to optimize the orientation and size of the graph before printing it.


Creating Graphs of One-Dimensional Motion

While this program is not really designed to model one-dimensional motion, one can do this by defining the object's initial velocity in, say, the y direction to be, say 1.0 m/s, and then setting only the x component of the acceleration. Since the object's y-velocity will be constant, this will essentially make the y axis a time axis. "

More About Entering Expressions

Please note the following when entering mathematical expressions into acceleration boxes in the setup dialog. The variables x, y, z, t, r, v, vx, vy, vz, and pi  are automatically defined and can be used in any expression. Valid operators are + (addition), - (subtraction), * (multiplication), / (division), and ^ (raising to a power). Some examples of valid expressions are



  (vx^2 + vy^2)/3


The usual rules of precedence of operations apply: for example in the expression a+b*c^-(d+e), the quantity (d+e) is evaluated first (because it is in paretheses), the result is then negated, the value of c is then raised to that power (since powers have precedence over other operations), the result is then multiplied by b (because multiplication and division take precedence over addition and subtraction), and finally a is added to the result.

The following is a list of the available functions that one can use: "

   pow(x,y) is equivalent to x^y

   deg(x) converts x in radians to degrees

   rad(x) converts x in degrees to radians

   exp(x) is the exponential function

  ln(x) is the natural logarithm

   log(x) is the base-10 logarithm

   sin(x), cos(x), and tan(x) all take arguments in radians

   asin(x), acos(x), and atan(x) are inverse trig functions, which return results in radians

   ceil(x) returns the next integer above (less negative than) x

   floor(x) returns the next integer below (more negatve than) x

   frac(x) returns the fractional part of x (e.g. frac(-2.51) = 0.51)

   rnd returns a random number between 0 and 1

   min(x,y) returns x if x < y, or y if y < x

   max(x,y) returns x if x > y, or y if y > x

   mod(x,y) returns x mod y

   sinh(x), cosh(x), and tanh(x) are hyperbolic trig functions

   asinh(x), acosh(x), and atanh(x) are inverse hyperbolic trig functions

Saving Information

Version 2.4 added the ability to create a text file that saves the result of a run as a tab-delimited text file for use in another program. Either press the "Save..." button or select "Save Data..." from the File menu and select a place to save the file in the dialog window that pops up. Each of the lines in the data file specify the time, the horizontal position at that time, and the vertical position at that time, separated by tabs. This file can be directly imported into a spreadsheet or similar program for further analysis. If the "w/units" check box is checked, the first line of the data file will contain the time unit, horizontal axis unit, and vertical axis unit, separated by tabs. Keeping units with the file is desirable (which is why I have made it the default), but I have made it optional because not all importing programs can handle the units. 

Update Information

Versions 2.5 and 2.6 added bug fixes and Universal Binary support. Version 2.7 changed the mechanism for displaying the help file, so that the help displays better on Windows systems and also made the program quit when its main window is closed, consistent with other programs.

Concluding Comments

I have tried to make this program as transparent and as easy-to-use as possible. Please send any bug reports or feature requests to me at This program was written using REALBasic, a superb development environment for Macintosh, Windows, and Linux platforms. For more information, visit This program is freeware, and may be freely distributed, used, and/or modified, subject to the terms of the GNU General Public License, version 2 or higher (