Home : Course Map : Code Index JavaTech Programs & Code Index
 About JavaTech      Codes List      Exercises      Feedback      References      Resources      Tips      Topic Index      Course Guide      What's New
 Here we provide an index to the programs and source code developed for this web course. This includes a number of starters that we used as the initial code for many of the programs. Program List as of Sept. 20, 2005 Part 1: Part 2: Networking - 12 programs Part 3: Out of the Sandbox - 8 programs Starter programs AWT Applets - note that some have main() to run as apps Swing Applets - note that some have main() to run as apps AWT Applications Swing Applications

 Part 1: Physics Ch Name Code Description 2 Demo 1: Falling Object Uses the Euler method to location and speed of an object falling in constant gravitational field. Separate applet and application versions. Demo 2: Harmonic Motion - Predictor-Corrector Spring_Applet1 Spring_App1 use the PC method to solve for spring motion. 3 Particle Class Particle Class to illustrate objects in physics. Not used in a demo program. Demo 1: Root finding with Bisection Bisection_Applet5 Use the bisection root finding method to solve for the landing point of a projectile. Demo 2: Root Finding with Newton's Method Newton_Applet5 Use Newton's method to find the landing point of a projectile. 4 Demo 1: Projectile Motion with 2nd Order R-K RK2ndApplet.java, RungeKutta2nd.java, Derivable.java , Use the second order Runge-Kutta method to calculate the trajectory of a ballistic projectile. Demo 2: Runge-Kutta Method RK4thApplet.java, RungeKutta4th.java Use fourth order Runge-Kutta method to calculate the trajectory of a ballistic projectile. Demo 3: Shooting at a Target ShootApplet.java , Shooter.java, RungeKutta4th.java Illustrate the shooting method for solving a 2-D differential equation problem. Uses 4th order R-K from previous demo. Discrete Newton technique used to find the parameters for the shooting. 5 Demo 1: Integration Methods IntegrateApplet.java, TrapezoidInteg.java, RectInteg.java , Integrator.java Function.java Demonstate the rectangular and trapezoidal approaches to numerical integration. We also demonstrate more sophisticated object oriented program design based on interface implementations. Demo 2: Simpson's Integration Rule Uses the Integrate interface discussed in Chapter 5: Physics : Demo 1 to create class to carry out the Simpson's rule integration. 6 Demo 1: Display Text Data in a Swing Panel FallingObjectApplet.java, TextOutputPanel.java, Outputable.java Demonstrate a graphical user interface by using the Chapter 2: Physics : Demo 1: Falling Object code to send text output to a Swing panel rather than to the console. Demo 2: Plot Data with Java Graphics DataPlotApplet.java, DataPanel.java, PlotPanel, PlotFormat, This program draws data points on the PlotPanel component discussed in Chapter 6: Tech : Starting to Plot. Here we create the DataPanel subclass of PlotPanel. As in the Chapter 6: Physics: Demo 1, we use code from the Euler method demo program in Chapter 2: Physics : Falling Object. 7 Demo 1 : Generating Custom Random Distributions RanDistAnglesApplet Histogram, HistPanel PlotPanel, PlotFormat Creates a random distribution of angles as might be seen for tracks entering a detector element in a particle scattering experiment. Demo 2: Histogram Distribution RanDistHistApplet Histogram, HistPanel PlotPanel, PlotFormat Generate a distribution in a histogram that follows a radioactive decay distribution using the transform method discussed above. Demo 3: Monte Carlo Integration MCPlotApplet MCPanel SinFunc, Function PlotPanel, PlotFormat Integrates 1-D functions using a Monte Carlo approach. The user generates different functions via the buttons. MCPanel is a subclass of PlotPanel that draws a function and the scatter of points used for the MC integration. The function plot is created with a Polygon object. By wrapping the points around the boundary we can use the contains() function in Polygon to obtain the number of points below the function curve. SinFunc is a function used to generated the curve for integration. Implements the Function interface. 8 Dem 1: Least Squares Fit to a Straight Line LsfLineApplet FitLine, Fit DrawFunction, DrawLine DrawPoints, DrawPanel Histogram, HistPanel PlotPanel, PlotFormat Generates points along a line and then fits a straight line to them. This simulates track fitting in a detector. The number of tracks and the std. dev. of the smearing of the track measurement errors taken from entries in two text fields. Two histograms record differences in the slope and intercept for the fitted track with the generated track. A third histogram holds the residuals. FitLine, a subclass of Fit, does a least squares fit to a straight line. Fit is an abstract class that allows for subclasses to apply different kinds of data fitting algorithms to 2-D data. Dem 2: Least Squares Fit to a Polynomial PolyFitApplet FitPoly, DrawPoly Fit DrawFunction, DrawPoints DrawPanel Histogram, HistPanel PlotPanel, PlotFormat + classes from the JAMA: Java Matrix Package This program generates points along a quadratic line and then fits a polynominal to them. A histogram displays the residuals. See Demo 2 page for descriptions of other classes. Dem 3: Fitting Histogram With Errors HistFitApplet HistogramFit HistogramStatR1 FitPoly, DrawPoly Fit DrawFunction, DrawPoints DrawPanel, DrawLine HistErrPanel Histogram, HistPanel PlotPanel, PlotFormat Create a random distribution of values and then fit a polynominal to the bin values. HistogramFit provides a static class that takes a histogram as an argument and fits the distribution of values to a polynominal of a given degree. Dem 4: Discretization Dem 5: Timing in Simulations 9 Demo 1: Physics Simulation Program DropTestApplet DropPanel DropModel Histogram, HistPanel PlotPanel, PlotFormat Simulate the droppinig of a mass in a constant gravitational field. This class provides the top level applet/app that controls the program and displays on the applet panel the user interface. DropPanel is a subclass of PlotPanel that displays the experiment simulation, i.e. the falling mass DropModel generates the physics data for the simulation. Demo 2: Experiment Simulation with a Detector DropTestDetectApplet DropPanelDetect DropModelDetect DropDetector1 Detector Histogram, HistPanel PlotPanel, PlotFormat Simulate an experiment that measures the acceleration of a dropped mass. The detector looks at the times when the mass crosses fixed positions and calculates the change in velocity between the top pair and the bottom pair of measurements. See Demo 2 page for descriptions of other classes. Demo 3: Experiment Simulation with Analysis Module DropTestAnalysisApplet DropAnalyzer DropDetector2 DropPanelDetect DropModelDetect Detector FitPoly, DrawPoly, Fit DrawFunction, DrawPoints DrawPanel, PlotPanel, PlotFormat Simulate a experiment in which a dropped ball leaves marks every DT interval, as in a spark chart experiment. Includes fitting of the data with LSQ fit using previous classes developed for that purpose. See Demo 3 page for descriptions of other classes. 10 Demo 1: Drop Simulation data generator DropGenerator DropDetector2 Detector DropPanelDetect DropModelDetect PlotPanel, PlotFormat Simulate the mass drop experiment and generate a file with the data for each event. Similar to Demo 3 of Chapter 10 except that the analysis part has been split off into Demo 2 below. Also, the GUI provides a check box for the user to select for data output and a text field for the user to enter the name of the data file. Demo 2: Drop Data Analysis Program DropDataAnalysis DropAnalyzer FitPoly, Fit, DrawPoly DrawFunction, DrawPoints DrawPanel, PlotPanel, PlotFormat + classes from the JAMA: Java Matrix Package This application program with a frame reads in and analyzes the data generated by the DropGenerator simulation program. Uses DropAnalyzer from Chapter 9. The user selects the data file by opening a JFileChooser via a menu item in a dropdown munu from a menu bar. 11 Demo 1: Drop Simulation with Instrument and Systematic Error DropGenCalSysErr DropDetector3 DropDetector2 Detector DropPanelDetect DropModelDetect PlotPanel, PlotFormat Generate more realistic data for the mass drop experiment demo by allow the user to add an offset to the position data to simulated instrument effect. A special calibration run mode allows for determination of the instrument effect. The user can also include a systematic error on the time span between measurements. Demo 2: Drop Data Analysis with Calibration DropDataAnalysisCalSysErr DropAnalyzerCalSysErr FitPoly, Fit, DrawPoly DrawFunction, DrawPoints DrawPanel, PlotPanel, PlotFormat + classes from the JAMA: Java Matrix Package Analysis of the output of DropGenCalSysErr allows for a "calibration" constant to be subtracted from the position data. 12 Demo 1: Plotting, Histograming, and Fitting with JAIDA Remake the Chapter 8: Physics : Demo 1: Least Squares Fit to a Straight Line with the JAIDA plot, histogram and function fitting classes.