In[]:=
g[func_,t_]:=Integrate[func,x]/.x->t;​​​​Manipulate[Show[(*Plottingtheuserfunction*)Plot[{If[t<a+1,1,0]*g[userFunc,t],(userFunc/.x->t)*If[t<a+1,1,0]},{t,0,a+1},Filling->{2->Axis},Axes->False,PlotRange->{{-xal,xax},{-yaxb,yax}}],Graphics[{Green,Thick,Line[{{a-.7,(g[userFunc,a-0.2]+(userFunc/.(x->a-0.2))*-.5)},{a+0.3,(g[userFunc,a-0.2]+(userFunc/.(x->a-0.2))*.5)}}]},{Black,Line[{{a+0.3,g[userFunc,a-0.2]},{a-0.2,g[userFunc,a-0.2]}}]},{Black,Line[{{a+0.3,g[userFunc,a-0.2]},{a+0.3,g[userFunc,a+0.3]}}]},{Red,Line[{{a,g[userFunc,a]},{a,g[userFunc,a-0.2]}}]},{Dashed,Purple,Line[{{a,0},{a,g[userFunc,a]}}]},{Dashed,Purple,Line[{{a-0.2,0},{a-0.2,g[userFunc,a-0.2]}}]},{Black,Line[{{a-0.1,g[userFunc,a-0.1]},{a-0.1,g[userFunc,a-0.2]}}]},{Black,Circle[{a-.1,(userFunc/.x->a-.2)},0.22]},{Black,Line[{{a-.2,(userFunc/.x->a-.1)},{a,(userFunc/.x->a-.1)}}]},{Black,Line[{{a-.2,(userFunc/.x->a-.1)},{a-.2,(userFunc/.x->a-.2)}}]},{Brown,Line[{{a-.2,.0},{a-.2,(userFunc/.x->a-.2)}}]},{Brown,Line[{{a-.1,.0},{a-.1,(userFunc/.x->a-.1)}}]},{Brown,Line[{{a,.0},{a,(userFunc/.x->a)}}]},{Thick,Red,Line[{{.0,g[userFunc,a-.2]},{.0,g[userFunc,a]}}]},Text[Style[" a ",Black,12],{a-.2,.1}],Text[Style[" b ",Black,12],{a,.1}],Text[Style[" area via length",Red,12],{.5,g[userFunc,a]+.15}],Text[Style[g[userFunc,a]-g[userFunc,a-0.2],Red,12],{.5,g[userFunc,a]-.15}],Text[Style[" area via approx",Brown,12],{.5,(userFunc/.x->a)-.15}],Text[Style["=1 rectangle with Δx 0.2 "0.2*(userFunc/.x->a-.10),Brown,12],{.20,(userFunc/.x->a)-.30}],​​Text[Style["=2 rectangles with Δx 0.1 "((0.1*(userFunc/.x->a-.15))+(0.1*(userFunc/.x->a-.05))),Brown,12],{.20,(f/.x->a)-.45}],Text[Style[" F(b)"(g[userFunc,a])/1.0,Blue,12],{-0.5,g[userFunc,a]}],Text[Style[" F(a)"(g[userFunc,a-.2])/1.0,Blue,12],{-0.5,g[userFunc,a-.2]}],{Dashed,Purple,Line[{{0,g[userFunc,a]},{a,g[userFunc,a]}}]},{Dashed,Purple,Line[{{0,g[userFunc,a-.2]},{a,g[userFunc,a-.2]}}]},{Dashed,RGBColor[.38,.51,.51],Line[{{0,(userFunc/.x->a)},{a,(userFunc/.x->a)}}]},PlotRange->{{-xal,xax},{-yaxb,yax}}​​]​​,Axes->True,ImageSize->{600,700}​​],{{xal,1,"x-axis-left"},1,20},{{xax,6,"x-axis-right"},3,20},{{yax,6,"y-axis-height"},3,30},{{yaxb,2,"y-axis-depth"},2,30},{{a,4,"x-value"},1,8.99,.2},{{userFunc,x^2/10,"User Function (you may overwrite it with your own function) "},InputField,Appearance->"Frameless"},ButtonBar[{"f(x) x^2/10":>(userFunc=x^2/10),"2x":>(userFunc=2x^1),"0.5x":>(userFunc=0.5x^1),"x - x^2/6":>(userFunc=x-x^2/6),"Sqrt[x]":>(userFunc=Sqrt[x])}],SaveDefinitions->True,TrackedSymbols:>{userFunc,xal,xax,yax,yaxb,a}​​]
Out[]=
​
x-axis-left
x-axis-right
y-axis-height
y-axis-depth
x-value
User Function (you may overwrite it with your own function)
2
x
10
f(x) x^2/10
2x
0.5x
x - x^2/6
Sqrt[x]
​​Thanks to ​Chris Boucher who created the original version of “The Fundamental Theorem of Calculus”​http://demonstrations.wolfram.com/TheFundamentalTheoremOfCalculus/​His version helped me learn Mathematica and see how easy it is to visualise and test some extra ideas.This version is meant to be more ‘educational’ and attempts to help you reinvent the theorem (re)starting from (almost) zero.The videos of Grant Sanderson on https://www .3blue1brown.com were a great inspiration. I am convinced that without the ‘physics’ interpretation of instant velocity/acceleration the abstraction of the fundamental theorem of calculuswill not be fully understood and remembered by students.​​
The fundamental theorem of calculus ​
Iffisacontinuousfunctionon[a,b]andFisanantiderivativeforfon[a,b],then
b
∫
a
f(t)t=F(b)-F(a).
​Simply put : calculus - among other things - makes it possible to calculate an area by measuring a length​The area under a (part of ) a curved has long been a problem to calculate.The total area of the area between the x-axis and the function value is approximated by the summation ​
x
∑
x=
f(x)
Δx (with Δx -> 0) Newton and Leibniz were the first to find a way to calculate this approximation exactly making Δx infinitesimal small.​In the above graph of f(
2
x
/10) with F(
3
x
/30) this is shown with a right x-axis of 6 and an x-value of 4. Here the striped area under the orange curve from a (3.8) to b (4) is equal to
0.304267
,​that is the difference of the values of the antiderivative ( blue line ) at the end (
2.13333F(b)
) and start (
1.82907F(a)
) of the basis of this area.The approximation of the summation of one rectangle under the function f(x) with basis of 0.2 (
0.3042"=1 rectangle f(x)Δx with Δx 0.2 "
) is better than that the summation of two rectangles with basis of 0.1 (
0.30425"=2 rectangles f(x)Δx with Δx 0.1 "
) As we will show in more detail the fact that the function under which we try to calculate the area exactly is the derivative of F(x), makes that all indefinitely small changes to F(x) are the same as the areas of indefinitely small extra rectangles under f(x). ​​The Leibniz integration symbol ∫ in fact shows this smooth continuous change in contrast to the summation symbol
∑
.​​When you make the x-value in the graph larger ( via the slider or via the + sign ) you see that F(x) is growing faster for higher x-values. Or in terms of the theorem: the larger areas under higher x-values of f(x) are reflected in faster growing values of F(x)Experimenting with different functions will give you a real understanding of the theorem and relation between a function and its antiderivative.To see things clearly you may have to adjust the x and y-axis values. ​​​Things you should see, know and try out​​The following attempts to reinvent the theorem Newton and Leibniz discovered for the first time some 350 years ago.We accelerate the reinvention process using Leibniz’s notation and the dynamics Mathematica offers.But ... only having some physics experience with change and trying out things yourself and seeing how related values change may provide a reinvention ‘Aha’ Erlebnis.​How the hell did Newton and Leibniz come up with the idea to relate the antiderivative and the derivative function?​They could only have been doing this abstraction via concrete relationships of e.g. velocity versus traveled distance or e.g. acceleration versus velocity. For this reason students can only grasp the full meaning of the abstract theorem translating it to these ( and other) continuous change relationships. And so we arrive at the ( counterintuitive ) notion of instant velocity and instant acceleration where the videos of Grant Sanderson are of great help. You really should see https://www.3blue1brown.com/lessons/derivatives and https://www.3blue1brown.com/lessons/essence-of-calculus before experimenting with this notebook.​​In the image above, the brown curve y=f(x) — you have five choices— and the blue curve is Y=F (x).​An explicit difference between y (for f(x)) and Y (for F(x)) is not shown in the axis, but it is essential.( Newton himself made a graph where he put the derivative above and the antiderivative below the axis https://www.youtube.com/watch?v=Chy8eCoT9sw ).Adding an extra 0.2 to the x-value shows the brown striped area under f(x) that is reflected in the red length of the Y value of F(x). ​The extra brown striped area under f(x) approximated by a rectangle of length 0.2 and two rectangles of length 0.1 ( the last will give a better approximation).Depending on the function the extra area grows very quickly ( as under y = 2x) or slowly ( as under y = Sqrt(x) ).​Let’s start with the simplest function y = 2x where the area under this function is a triangle, so that the area can be verified via the formula L x H / 2.Adding 5 extra 0.2 Δx parts to f(x) = 2x from 3 to 4 you see F(x) growing 1.24 + 1.32 + 1.4 + 1.48 + 1.56 = 7 = F(4) - F(3) = 16 - 9 = extra part rectangle 4f(4)/2 - 3f(3)/2.Note that in this case the brown approximations equals the real red value of the extra area, as the extra areas on the top of the rectangle above and under the function compensate ( see the black circle).The simple rectangle math can’t be used for non linear functions, so integral calculus is there to help us for example for the area under the functions like
2
x
/10.​Now you can ask the question why the extra red length of the Y value of F(x) is exactly the extra area under f(x).​This is because of 2 facts : 1) the directional coefficient of the green tangent to F(x) ( Y / x) is the value of f(x), meaning f(x) is the derivative of F(x) 2) the antiderivative value F(x) is composed of indefinitely small rectangles f(x)x is ( Y / x )*x, so Y. The last fact means
x
∑
x=
f(x)
Δx (with Δx -> 0) =
∫f(x)x=∫(dF(x)/x)x=∫F(x)=F(x)
​So F(x) is equal to the area under the function f(x) from x=0 to x=x. The theorem uses this to calculate the area under the function between 2 points a and b on the x-axis. Let’s discuss this in more detail.​​1)Derive the orange derivative f(x) function from the blue F(x) function.​https://www.3blue1brown.com/lessons/derivatives shows that “a small change in space traveled results from as mall change in instant velocity”.You should see the same here more generally for different functions that represent continuous change of any kind.The green line is the tangent on F(x) at a selected x-value and the directional coefficient is the value of f(x). Remember the directional coefficient y/x of a flat line is 0 , and of a 45° line it is 1. It keeps growing to infinity towards 90° where it changes sign as x gets below 0.It is calculated as ΔY/Δx -> 0 or Y/x To have a full understanding of this instantaneous change and its paradoxes watch the video https://www.youtube.com/watch?v=9vKqVkMQHKk ​The tangent is approximated by the hypotenuse of the smaller triangles on the left to F(x) with Δx changing from 0.5 to 0.2 to 0.1 ...To not overload the image above the hypotenuses are not shown. With Δx 0.5 when the function curves enough, the deviation from the tangent can be seen.The derivative (slope) function y=f(x) of Y=F(x) is calculated limiting Δx -> 0 e.g. for y = F(x) =
2
x
it can be calculated that the function of the slope is 2x. This means that the slope is 1 at x=0.5 or 45°, 2 at x=1, 4 at x=2... so growing exponentially for a very fast climbing function F(x) =
2
x
. Y/x ≈ ΔY/Δx (with Δx -> 0) ≈ ( x + Δx )² -
2
x
/ Δx ≈
2
x
+ 2x Δx + Δ
2
x
-
2
x
/ Δx ≈ 2x Δx + Δ
2
x
/ Δx (Δ
2
x
≈ 0, Δx -> 0) = 2x Δx / Δx = 2xWhen selecting f(x) = 2x and making the x-value larger and larger you can easily see that the growing area under a linear function reflected in an exponential antiderivative function.​​​2)The value of the antiderivative blue F(x) function is composed of indefinitely small rectangles under the brown f(x) function.​To ‘reinvent’ the fundamental theorem of calculus one has to go the other way round and prove that areas under f(x) are related to lengths of F(x).Watch the video https://www.3blue1brown.com/lessons/essence-of-calculus to have an intuition of what we are trying to demonstrate. If we take a = 0 and F (a) = 0 for convenience, then F (x) is the area under the graph of f from 0 to x and f (x) is the derivative (slope) of F (x).So calculus should make it possible to translate areas in lengths by integrating/adding small portions of f(x)x​
∫f(x)x=∫(dF(x)/x)x=∫F(x)=F(x)
​​One can see in the image above that the integration of small f(x)x parts under f(x) is approximated by a striped rectangle f(x)Δx with Δx = 0.2 and height f(x -0.1) So the total area of the area between the x-axis and the function value is approximated by the summation ​
x
∑
x=
f(x)
Δx (with Δx -> 0) The area value approx(imated) is the value of this approximation of the striped area under f(x) and height f(x - 0.1).​The real value is shown by the area length value F(x) - F(x - 0.2)​For example select the function
2
x
/10 set at x=4.4 and y-axis height = 7 ( you can expand a slider or clicking the + sign at the end of it ).You can see that the rectangle approximation with Δx = 0.2 is 0.3698 and the real value is 0.369867​The 0.000067 difference is due to the extra area falling in the rectangle not exactly compensated by the extra area under f(x) ( see the black circle). Lowering Δx from 0.2 to 0.1 ... also lowers this difference. Adding 2 rectangles of Δx = 0.1 the approximation becomes 0.36985, a lot closer to the real value.​But why is the extra red length of the Y value of F(x) exactly the extra area under f(x)?​I must admit that in high school I never really grasped this completely. We were only told that with ever smaller rectangles the exact area under f(x) was becoming closer and closer.But I never made a final step in realising that with f f(x) as the derivative of F(x) this was exactly what was defined. At the time i did not really appreciate the invention of Newton and Leibniz.In 1) the value y of f(x) was calculated as ΔY/Δx -> 0 or Y/x, y = Y/x. So the indefinitely small rectangle y*x = (Y/x)*x or Y. Or a small change of area is reflected in a small change of length.Summing up these rectangles with indefinitely small x is the same as summing up all the small Y and will give the exact extra area value under f(x).As stated in the theorem this is only so for a continuous function where the slope ( and thus the Y values as x is the same for f(x) and F(x) ) change very smoothly.And so, as stated by the theorem
b
∫
a
f(x)x=F(b)-F(a)
​saying the area under a continuous function y=f(x) with x between a and b can be measured by subtracting length of Y values of the integrated function.​​Things to try out yourself:​- Change the x-value slider ( expanding the + sign you have more control ) and see the surface of f(x) growing with a striped area that is approximated by the growth of F(x)Under the function f(
2
x
/10) the surface is exponentially growing and this is reflected in the exponentially growth of F(x) - Choose another function and try the same thing. Adjust the x-axis and y-axis-height sliders to see the full function f(x) = 2x and F(x) =
2
x
and watch how the extra surfaces growing very fast so that you have to adjust the y-axis-length. The extra surfaces diminish exponentially and approximate 0 for f(x) = x -
2
x
/6 at x = 6 where it crosses the x-axis, and F(x) reaches its maximum. Adjust the y-axis-depth slider to get the negative function below 0.You can also change the ‘User Function’ value with another function of your own. - If you purchased Mathematica you can play with the source code of only 20 lines long. ... and have much more fun in simulating change.​​
​
​
​
​