Demonstrations

Graphing

A good place to start. This application shows how to register data points from within a program, clear data from a graph, and change scale.

Right click on the graph to bring up the Inspector while the program is running.

GraphTst.ZIP Pascal source and Delphi project.
GraphTst.EXE Application only.

Numbers

Getting numbers, i.e., real numbers of the form 6.26E+3, into a program can be difficult because standard Delphi objects only understand characters. SNumbers were created to solve this problem. Just draw an SNumber on a Delphi form. The SNumber takes care of converting the keystrokes into the double precision representation necessary to do calculations. The SNumber will turn red to warn the user if s/he makes a typing error. It will turn yellow when a number has been changed but that the computer has not yet read the number.

SSliders are another object in Science Tools. Their maximum and minimum values can be floating point numbers, unlike Windows sliders which can only take on integer values. Notice that the slider can be tied to a SNumber component so that these components mirror each other's values. See the OnFormCreate method in this application.

Slider.ZIP Pascal source and Delphi project.
Slider.EXE Application only.

Input Output Testing

Combine a graph, number input, and sliders in a single application. A data point will be added to the graph whenever you move the slider.

You can also plot of an analytic function on the graph using the built in parser.

IO_Test.ZIP Pascal source and Delphi project.
IO_Test.EXE Application only.

Matrix Plot

Plot a function of two variables, F(x,y), as a contour plot, a 2D surface plot, or as a checker plot. Switch between these representations at run time and compare rendering speed. Be sure and right mouse click on the plot to see how the inspector works.

A useful app for learning how to use the parser.

MatPlot.ZIP Pascal source and Delphi project.
MatPlot.EXE Application only.
Instructor's Etudes

Quadratic

Solve the quadratic equation and graph the result. Use this example to build your first program, a linear equation solver.
Quad.ZIP Pascal source and Delphi project.
Quad.EXE Application only.

Sinc Function

Plot multiple functions on a single SGraph. Numerical methods for the integral and derivative are introduced. Use this example as a template for code documentation.
Sinc.ZIP Pascal source and Delphi project.
Sinc.EXE Application only.

Linear Regression

Regression example for homework exercise #3. Use my solution for this exercise to test your solution! You can copy my interface or design your own but be sure and document your code.
Regress.ZIP not available!
Regress.EXE Application only.

Pendulum

Pendulum demonstrates how to solve an ODE and animate the solution. Animation is an advanced technique and is not required for homework. Write your own ODE code for the homework exercise. It is better to use the Euler or Verlet method than to use a method, such as Runge-Kutta, that you don't understand yet.
Pendulum.ZIP Pascal source and Delphi project.
Pendulum.EXE Application only.

Vector Transformations

Transform a vector using a 2 D matrix. This is a good example of how to draw onscreen using the mouse.
Transfor.ZIP Pascal source and Delphi project.
Transfor.EXE Application only.

Finding Roots

Find a root using Newton's method.
Transfor.ZIP Pascal source and Delphi project.
Transfor.EXE Application only.

Galton

Many of you will recognize the relationship between this simulation and the "penny toss" experiment that we do in Physics 120/130 lab. A ball is dropped onto a board with rows of pegs., i.e., a Galton board. It has a 50/50 probability of bouncing to the right or left at a peg before it moves on to the next row. After 10 rows we see how many more times the ball bounced to the right than to the left. Remember that the bounce is random so it is possible-- but not likely-- that the ball bounces to the left (or right) 10 times.
Galton.ZIP Pascal source and Delphi project.
Galton.EXE Application only.

Life

Conway's Game of Life is a "toy" ecological model. The cells grow or die based on a set of well defined rules.

Demonstrates how to use the mouse-down method for data input.

Life.ZIP Pascal source and Delphi project.
Life.EXE Application only.

Random Walk

Saturday night at the court. A drunk leaves a party, takes 25 random steps and falls down. On average, how far does the drunk get from the party?
RanWalk.ZIP Pascal source and Delphi project.
RanWalk.EXE Application only.