## Programming and Problem Solving by Connecting Diagrams

This is a demonstration of the VIP (View Interactive Programming) program. VIP allows the user to create scientific programs or to solve physics problems by connecting diagrams that represent physical and mathematical principles. The following example shows a specification for calculating the mass of the sun, following Newton's reasoning, by equating the gravitational attraction of the sun on the earth with the force required to keep the earth in circular motion.

This demo is created by selecting physical principles and connecting buttons on the diagrams to signify that quantities are equal. In the above diagram, the user first selects `Physics` from the command menu, then `Force` principles, then `Gravitation` to get a gravitation box and position it on the screen. Next, the user gets a `Centrifugal Force` box and adds it to the screen. By clicking on the `f` buttons in each box, the user signifies that these forces are equal; the system responds by drawing a line between the two `f` buttons.

The user selects `Constant` to obtain a menu of built-in constants, and then `Mass` and `Earth` to get a constant for the mass of the earth; this is connected to the two mass buttons in the boxes. Similarly, a `Length` constant for the `Earth-Sun` distance is connected to the two radius variables. The `Output` box is moved using the `Move` command and connected to the other mass button of the `Gravitation` box; this will be the answer, i.e. the mass of the Sun.

At this point, everything is specified in the diagram except the `v` button in the `Centrifugal Force` box; this is the velocity of the earth in its orbit. This can be found by noting that the earth goes around the sun in one year. The `Geometry` command is selected, and a `Circle` box is obtained. The radius of this circle is the `Earth-Sun` distance; by dividing the circumference of the circle by a time constant of one year, the velocity of the earth is obtained. The `Op` command allows a `/` box to be added to the picture. Finally, giving the `Done` command generates a program to do the calculation.

When the program is started, a window is created with a command menu and input and output areas. Use the command Output Language to select the desired language for the program that is created. (The actual program will be served to you in a file that is presented after the demo program is terminated.) Use the input lines to specify the name and type of each input variable, one per line, in the format shown. Examples are `(radius integer)` and `(speed (units real mph))`. Then select the command New Program to start VIP.

A VIP program is created by connecting diagram boxes that represent variables and physical and mathematical principles. A connection signifies that two quantities are equal. To make a connection, click the mouse, once for each end of the connection, on variable boxes or on "buttons" associated with diagrams. To get a useful program, there must be a connection to the `OUTPUT` box.

The VIP commands are as follows:

• `Done ` Finished; make a program from the diagram.
• `Redo ` Start over.
• `Move ` Move a box. Click the box you wish to move.
• `Delete ` Delete a box or a connection.
• `Geometry ` Select a new geometric principle box.
• `Physics ` Select a new physical principle box.
• `Make Var ` Make a local variable.
• `Specify Type` Specify the type of a variable. This can also be used to specify units.
• `OP ` Make an operation box, such as `+ - * /`.
• `Type-in ` Type in a numeric constant, with units if desired.
• `Constant ` Select a predefined constant, such as the speed of light.

You must have the Java virtual machine installed to run this demo; you can get it for Windows (msjavx86.exe) here.

The best things in life are free: this demo uses the free software Gnu Common Lisp (GCL), XGCL, X windows [see also XFree86], Java, and WeirdX, a Java implementation of an X server.

## Instructions

1. If needed, edit your display name. It should end in :2.0, for example, ` myterminal.cs.utexas.edu:2.0 `
2. Click to start the demo. Scroll down to see the interaction window below.

First describe inputs (if any) to the program; then click New Program.

Click on the command menu to perform actions and add new elements to the diagram.

Click on buttons within diagram elements to connect them. Connected items are constrained to be equal.

Gordon S. Novak Jr.