# Please run this Wolfram mathematica

Posted 8 years ago
7842 Views
|
2 Replies
|
0 Total Likes
|
 Hi there. I need someone to help me run the following code and produce a wolfram mathematica. I need the file in as .nb. Many thanks. CreateDistribution[] := DynamicModule[{savepts = {{-1, -1}}}, Dynamic[ EventHandler[ ListPlot[pts, AxesOrigin -> {0, 0}, PlotRange -> {{0, 7}, {0, 5}}], "MouseDown" :> (savepts = pts = DeleteCases[ Append[pts, MousePosition["Graphics"]], {-1, -1}])], Initialization :> (pts = savepts)]] CreateDistribution[] lm = LinearModelFit[Sort@pts, a, a]; r2 = lm["RSquared"]; Show[Plot[lm[x], {x, 0, 7}], ListPlot[pts], AxesOrigin -> {0, 0}, PlotRange -> {{0, 7}, {0, 5}}, PlotLabel -> "The correlation is " <> If[D[lm["BestFit"], a] < 0, "negative", "positive"], Epilog -> Inset[Style[ "\!$$\*SuperscriptBox[\"R\", \"2\"]$$ = " <> ToString[r2], 11], {1.5, 4.5}]] lm = LinearModelFit[Sort@pts, {1, x (*, x^2 *)}, x]; {bands68[x_], bands95[x_], bands99[x_]} = Table[lm["SinglePredictionBands", ConfidenceLevel -> cl], {cl, {0.6827, 0.9545, 0.9973}}]; Show[ListPlot[Sort@pts], Plot[{lm[x], bands68[x], bands95[x], bands99[x]}, {x, -0.15, 7.2}, Filling -> {2 -> {1}, 3 -> {2}, 4 -> {3}}], AxesOrigin -> {0, 0}, PlotRange -> {{0, 7}, {0, 5}}, ImageSize -> 480, Frame -> True] 
2 Replies
Sort By:
Posted 8 years ago
 To "produce a wolfram mathematica" takes a lot of people many years. I guess you meant a Mathematica notebook (nb) file. I attached one from after evaluating the code. Empty plots and division-by-zero warnings. You have some debugging to do. Attachments:
Posted 8 years ago
 Is there a question? You seem to just be asking for someone to run your code for you. Since the code is interactive and uses Dynamics, more explanation of what is needed would be helpful.