Math 1483 - Quiz 5

<=/Solutions\=>

Remember, ALT+7 gives a new text cell, be sure to explain your answers, if needed!

Problem 1

There are four data sets given below.  I have used an Iconize function so that you do not have to actually look a the 200 points in each data set.  Simply execute the command to store data sets to the variables as you would on any other command.

These data sets need to be modeled by functions. Your choices of functions are as follows:

L(x)  = m x + b
Q(x) = a (x^2)+b x + c
C(x) = a (x^3)+ b (x^2)+ c x + d
E(x) = a + b* (c^t)

The first is the definition of the linear function, the second is the quadratic function, the third a cubic equation, and lastly, the fourth is  an exponential function.

DataSet1 = ;
DataSet2 = ;
DataSet3 = ;
DataSet4 = ;

Part 1

Plot each data set on its own graph.

DataSet1ListPlot = ListPlot[DataSet1]

DataSet2ListPlot = ListPlot[DataSet2]

DataSet3ListPlot = ListPlot[DataSet3]

DataSet4ListPlot = ListPlot[DataSet4]

Part 2

For each of the graphs in Part 1, determine which of the functions, L(x), Q(x), C(x), and E(x) would be the best model.  You will use each model once, so each data set will have its own model.

DataSet1 is quadratic, so Q(x) is the correct model.
DataSet2 appears to be linear, so L(x).
DataSet3 is the exponential model, E(x).
DataSet4 is cubic, so C(x) will be the model.

Part 3

Find the best fit model for DataSet1 using the  corresponding function for which you selected in Part 2.

DataSet1BestFitQuadratic = LinearModelFit[DataSet1,{1,t,t^2},t]

The best fit quadratic is Q(x) = 1.73741 +0.7323173620068276` t-0.12018767024611414` (t^2).

Part 4

Plot your best fit model and DataSet1 together on the same graph.  Make sure the curve fits the data reasonably well.

DataSet1BestFitQuadraticPlot=Plot[DataSet1BestFitQuadratic[t],{t,1,6}, PlotStyle->{Red, Thickness[0.004]},PlotLegends->{"Best Fit Quadratic",LegendMarkers->Automatic}];

Show[DataSet1BestFitQuadraticPlot,DataSet1ListPlot]

Part 5

Find the best fit model for DataSet2 using the  corresponding function for which you selected in Part 2.

DataSet2BestFitLine = LinearModelFit[DataSet2,{1,t},t]

The best fit line is L(x) =5.113205126759607` +0.4408714985838899` t.

Part 6

Plot your best fit model and DataSet2 together on the same graph.  Make sure the curve fits the data reasonably well.

DataSet2BestFitLinePlot=Plot[DataSet2BestFitLine[t],{t,-7,7}, PlotStyle->{Red, Thickness[0.004]},PlotLegends->{"Best Fit Line",LegendMarkers->Automatic}];

Show[DataSet2BestFitLinePlot,DataSet2ListPlot]

Part 7

Find the best fit model for DataSet 3 using the  corresponding function for which you selected in Part 2.

For the exponential function, we have to use the FindFit command.

Clear[A,B,CC,t]

Model = A*B^t+CC;

fit = FindFit[DataSet3,Model,{A,B, CC},t];

DataSet3BestFitExponential = Function[{t},Evaluate[Model/.fit]]

So the best fit exponential function is E(t) = 12.418522395717158` +0.03661757786007952` ((1.635809484433643`)^t) .

Part 8

Plot your best fit model and DataSet3 together on the same graph.  Make sure the curve fits the data reasonably well.

DataSet3BestFitExpPlot=Plot[DataSet3BestFitExponential[t],{t,-3,12}, PlotStyle->{Red, Thickness[0.004]},PlotLegends->{"Best Fit Exponential",LegendMarkers->Automatic}];

Show[DataSet3BestFitExpPlot,DataSet3ListPlot, AxesOrigin->{0,12}, PlotRange->{{-3,15},{10,20}}]

Part 9

Find the best fit model for DataSet4 using the  corresponding function for which you selected in Part 2.

DataSet4BestFitCubic = LinearModelFit[DataSet4,{1,t,t^2,t^3},t]

The best fit cubic is C(x) = -0.21142316979421`+4.2822933795423594` t-1.4782815266371718` (t^2)+0.10127780611382405` (t^3).

Part 10

Plot your best fit model and DataSet4 together on the same graph.  Make sure the curve fits the data reasonably well.

DataSet4BestFitCubicPlot=Plot[DataSet4BestFitCubic[t],{t,-6,11}, PlotStyle->{Red, Thickness[0.004]},PlotLegends->{"Best Fit Cubic",LegendMarkers->Automatic}];

Show[DataSet4BestFitCubicPlot,DataSet4ListPlot, PlotRange->{{-5,10},{-30,5}}]

Problem 2

Simply rejoice, it has been a long semester.  Congratulate yourself for getting this far, good luck with the rest of your classes!