Maple Examples for MA 314

Curve Fitting (via Chebyshev and Least Squares Criteria)

In this example we construct different models that fit a given data using the Chebyshev and the Least Squares technique. Then the data is plotted together with the corresponding solution. The models illustrated are linear model y=Ax+B, and power model y=Ax2.


Interpolation of Data (Polynomial interpolation)

In this example using a certain data (say n data points) we construct the polynomial of degree at most n-1 that interpolates this data. Then we plot the polynomial and the data points.


Spline Interpolation (Spline interpolation)

In this example using a certain data (say n data points) we construct the cubic spline (degree at most 3) that interpolates this data. Then we plot the spline function and the data points.


Monte Carlo Simulation (Monte Carlo Simulation of Toss of a Coin and Roll of an Unfair Die Experiments)

The first example simulates the toss of a fair coin experiment to determine the probability of Heads or Tails. The second example deals with the roll of an unfair die with probability distribution of the outputs as follows;
 
Output
1
2
3
4
5
6
Probability
1/10
1/10
2/10
3/10
2/10
1/10

To simulate this experiment we choose a random number in [0,1] and assign to this experiment outcome 1 if the result is in [0,0.1] subinterval, 2 - if in [0.1,0.2], 3 - if in [0.2,0.4], 4 - if in [0.4,0.7], 5 - if in [0.7,0.9], and 6 - if in [0.9,1.0].


Harbor Simulation (Solution queuing problems using simulation techniques)

In this problem we simulate the arrival and the unloading of four ships in a harbor. The inter arrival times are assumed to be uniformly distributed between 15 and  145 minutes and the unloading times between 45 and 90 minutes. The output provides the average and the maximum harbor and waiting times, as well as the percentage that the unloading facility was idle.