Comments and suggestions added in pink- and blue-background cells.
Murray Eisenberg 2020-04-01
murray@math.umass.edu
Murray Eisenberg 2020-04-01
murray@math.umass.edu
The second fundamental theorem of Calculus.Larson Hostetler Edwards Calculus sixth ed pg. 280
b
∫
a
x
∫
a
“To avoid the confusion of using x in two different ways we temporarily switch to t”
There is a circle of understanding in the above of two equations. They are text and not active code. Before computers the same struggle to choose the letters and symbolism were also an issue! Written on paper with feathers and ink, sent by horseback and sail ship to mathematicians around the world, the problem was how to write the formulas in a conventional way that also kept the rigorous logic and computations intact. Consider the capitalization (upper case) of the F . Like a proper noun, capitol (upper case) F was understood as function like f ( lower)but also a name, or more strictly a title in an hierarchy of sentence structure. After exploring page 280, I purposed myself then to construct one simple elegant line of code that will capture the story being told, and perhaps one more for the picture. In this case the authors (textbook giants) ask for a plot to be made on CAS software of “for” (exact words) 0 ≤ x ≤ π Evaluated at 0, π/6, π/4, π/3, π/2. Then, an explanation of any expectations or whether or not it would look familiar. I think they, Hostedler Edwards and Larson, were assuming a math student might be surprised to see trapezoids and not a smooth sine curve . If all they want is an answer . . .
F(x)=cos(t)t
x
∫
a
I don’t understand your code in next input cell.
f[x_]:=Cos[t]t[{0,π/6,π/4,π/3,π/2}]
x
∫
0
Preferred way, I think:
In[]:=
f[x_]:=Cos[t]t
x
∫
0
In[]:=
f[{0,π/6,π/4,π/3,π/2}]
Out[]=
0,,,,1
1
2
1
2
3
2
The list {0,π/6,π/4,π/3,π/2} is also enclosed in brackets and there is no comma after the differential operator t. That was a welcome surprise. Generally these code lines are very critical on any CAS and very sensitive to commas brackets and braces and the placement or order of elements inside of lists! f[x], {x,0,pi} “the function of x as x goes to pi” or this . . . f[x], {x , 0, 5, .2 } “f of x goes 0 to 5 in steps of 2 tenths”. Observe removing the list and brackets leaves . The original graph asked for.
f[x_]:=Cos[t]t
x
∫
0
What is the point of using a “pure function” in the next input cell, given that you have already defined f? (Or, at least, should have, if you corrected to use the form I showed above.)
In[]:=
Functionx,Cos[t]t[{0,π/6,π/4,π/3,π/2}]
x
∫
0
Out[]=
0,,,,1
1
2
1
2
3
2
If you do want to start anew without explicitly defining f, then the preceding input is OK, and it could be entered also in the abbreviated form:
In[]:=
#
∫
0
Out[]=
0,,,,1
1
2
1
2
3
2
In[]:=
ShowListLinePlot0,,,,1,PlotStyleRGBColor[0.96,1.,0.89],PlotTheme"Detailed",MeshAll,BackgroundBlack
1
2
1
2
3
2
Out[]=
A bit strange the RGBColors. I seriously doubt anyone types these things in as opacity and hundredths of different shades of blue green and red. This is just point and click options. A black background and white line plot (including the points) produced [0.96,1.,0.89] which to me does not describe white. Not that I care since I am technically colorblind, but after reading the wolfram documentation, and also being a chemist, it just looks like all colors are at pretty much full power (especially the green coming in at full 1 (which I thought meant it would be “clipped”) and how exactly does that equal white? I remain dumbfounded at Show. Without it the line would appear but the data points would not. Does not Mesh ⟶All do that? Then why do I need Show?
Show is not required there. You may have looked at documentation related to some very old versions of Mathematica, where graphics were a side effect of a plot command rather than the actual output. All you need is the input shown below, where I’ve added an Epilog to highlight the points. (I omitted the MeshAll option since it doesn’t seem to add anything not already there in the output.)
Moreover, you are plotting the values of f[x] against {1, 2, 3,4,5}; surely it makes much more sense to plot them against the values of x themselves, which is what I do.
Moreover, you are plotting the values of f[x] against {1, 2, 3,4,5}; surely it makes much more sense to plot them against the values of x themselves, which is what I do.
In[]:=
xs={0,π/6,π/4,π/3,π/2};pts=Transpose[{xs,f[xs]}];ListLinePlot[pts,FrameFalse,AxesTrue,AxesLabel{x,TraditionalForm@HoldForm[f[x]]},Epilog{PointSize[Large],Red,Point/@pts},BaseStyle{13,Bold},PlotTheme"Detailed"]
Out[]=
If you don’t want to use Epilog, then you may indeed use Show to combine the separate graphics:
In[]:=
Show[{ListLinePlot[pts,FrameFalse,AxesTrue,AxesLabel{x,TraditionalForm@HoldForm[f[x]]},PlotTheme"Detailed"],Graphics[{PointSize[Large],Red,Point/@pts}]}]
Out[]=
Not sure why you would want such an unpleasant-looking plot as that one with white on a black background! Perhaps this would be a bit better if you indeed wanted a whitish graph against a dark background:
In[]:=
Show[{ListLinePlot[pts,PlotStyleWhite,FrameFalse,AxesTrue,AxesLabel{x,TraditionalForm@HoldForm[f[x]]},BackgroundLightGray,PlotTheme"Detailed"],Graphics[{PointSize[Large],Gray,Point/@pts}]}]
Out[]=
Note that you may actually directly plot f[x] vs. x throughout the interval and not just at selected points:
In[]:=
PlotEvaluate[f[x]],x,0,,FrameFalse,AxesTrue,Ticks{{0,π/6,π/4,π/3,π/2},{0,1/2,1}},AxesLabel{x,TraditionalForm@HoldForm[f[x]]},BaseStyle{13,Bold},PlotTheme"Detailed"
π
2
Out[]=
And you may make the upper-limit of integration dynamic:
In[]:=
Manipulate[Plot[Evaluate[f[x]],{x,0,b},PlotRange{{0,π/2},{0,1}},FrameFalse,AxesTrue,Ticks{{0,π/6,π/4,π/3,π/2},{0,1/2,1}},AxesLabel{x,TraditionalForm@HoldForm[f[x]]},BaseStyle{13,Bold},PlotTheme"Detailed",PlotLegendsNone],{{b,0.01},0.01,π/2}]
Now make it dynamic and show that alongside the dynamic plot of the integral function: