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 is the exponential model, E(x).
DataSet3 appears to be linear, so L(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.9331719660362292` -1.7069290536422255` t-0.20023090720235395` (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,-11,11}, PlotStyle->{Red, Thickness[0.004]},PlotLegends->{"Best Fit Quadratic",LegendMarkers->Automatic}];

Show[DataSet1BestFitQuadraticPlot,DataSet1ListPlot]

Part 5

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

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

Model = A*B^t+CC;

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

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

So the best fit exponential function is E(t) = 2.4008213239611607` +0.059144302231684216` ((1.2939432500189456`)^t) .

Part 6

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

DataSet2BestFitExpPlot=Plot[DataSet2BestFitExponential[t],{t,-3,18}, PlotStyle->{Red, Thickness[0.004]},PlotLegends->{"Best Fit Exponential",LegendMarkers->Automatic}];

Show[DataSet2BestFitExpPlot,DataSet2ListPlot, AxesOrigin->{0,0}, PlotRange->{{-3,18},{0,10}}]

Part 7

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

DataSet3BestFitLine = LinearModelFit[DataSet3,{1,t},t]

The best fit line is L(x) =3.7991579890205838` -2.9802085309070665` t.

Part 8

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

DataSet3BestFitLinePlot=Plot[DataSet3BestFitLine[t],{t,-2,10}, PlotStyle->{Red, Thickness[0.004]},PlotLegends->{"Best Fit Line",LegendMarkers->Automatic}];

Show[DataSet3BestFitLinePlot,DataSet3ListPlot]

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.1394706953960196` +1.1708167465822725` t-1.4597300106631308` (t^2)-0.30451093613039` (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,5}, PlotStyle->{Red, Thickness[0.004]},PlotLegends->{"Best Fit Cubic",LegendMarkers->Automatic}];

Show[DataSet4BestFitCubicPlot,DataSet4ListPlot]

Part 11

For the quadratic and cubic models you found for the data sets, compute the maximum and minimum values the functions obtain on the domain of the corresponding data sets.  Be sure to specify at which t values these maximum and minimums occur.  (Hint: NMaximize is a great function!)

Max[DataSet4[[All,1]]]

Min[DataSet4[[All,1]]]

NMaximize[{DataSet4BestFitCubic[t], -5.637 ≤ t ≤ 3.696},t]

NMinimize[{DataSet4BestFitCubic[t], -5.637 ≤ t ≤ 3.696},t]

DataSet4BestFitCubic[-5.637]

Max[DataSet1[[All,1]]]

Min[DataSet4[[All,1]]]

NMaximize[{DataSet1BestFitQuadratic[t], -5.637032256561237` ≤ t ≤ 9.88032182107723`},t]

NMinimize[{DataSet1BestFitQuadratic[t], -5.637032256561237` ≤ t ≤ 9.88032182107723`},t]

The minimum and maximum values for the quadratic Q(x) on the interval [-5.637,9.880] are -34.4785 at t=9.880 and 5.57098 at t = -4.2624, respectively.
The minimum and maximum values for the Cubic C on the interval [-5.637,3.6962485373131266`] are -30.8536 at t=3.69625 and 1.700 at t = -5.637, respectively.

Problem 2

Please write a sentence or two stating the positives of using Mathematica this semester.  Follow this with a sentence or two stating the negatives.  Keep in mind, if we did not use Mathematica, we would have had to do much of this work with a wee little TI-82, or maybe Desmos online (e.g., the nature of the course was to use technology to help solve problems, so technology was a requirement).

Problem 3

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