This commit is contained in:
Miloslav Ciz 2024-12-17 15:08:40 +01:00
parent 69630c448e
commit 80d186311f
9 changed files with 1868 additions and 1849 deletions

View file

@ -50,6 +50,8 @@ Now listen up, here comes the truth about calculus. Doing it correctly and preci
*Graph showing a function (`x`), its derivative (`*`) and (one of) its integral(s) (`#`).*
The basics of calculus aren't that hard, however it can go deeper and deeper and one can probably dedicate whole life just to learning more and more; as you learn the basic derivatives and integrals, you move on to multidimensional calculus, vector calculus, integrating over curves and surfaces, various esoteric methods of analytical and numerical integration etcetc.
## Derivative
Derivative finds how **quickly a function grows** at any given point. DOING derivatives is called **differentiation** (confusingly because differential is a term distinct from derivative). Since derivative and integral are opposite operations, one would assume they'd be equally difficult to handle, but no, derivative is the **easier** part! So it's always taught first. It's kind of like multiplication and division -- multiplication is a bit easier (division has remainders, undefined division by zero etc.).
@ -162,16 +164,20 @@ As already claimed in the section on derivative, integrating is **more difficult
- There is no simple [algorithm](algorithm.md) for integrating general function (only for some specific cases) and many functions do NOT have analytical solutions at all! I.e. while we can make a derivative of any (differentiable) function by just following simple rules, getting an integral of a function is often a matter of trial and error, integrating is kind of [art](art.md) that has to be learned. This may come as a surprise but it is so, it is similar to how for example factoring a number is much more difficult than multiplying the factors back.
- Unlike with derivatives there are infinitely many integrals of given function because functions that only differ by an added constant will give the same derivative (for example the functions *f(x) = x* and *f(x) = x + 1* will both have the same derivative) -- so when we're integrating we always get function that has a variable additive constant in it.
- Integrals don't have some nice mathematical properties that derivatives have, so we can't assume as much, for example a derivative of an elementary function is always elementary function but this is not the case for an integral. { At least I think :) ~drummyfish }
- Integrals don't have some nice mathematical properties that derivatives have, so we can't assume as much, for example a derivative of an elementary function is always elementary function (the set of elementary functions is closed under differentiation) but this is not the case for an integral.
- Integrating a function makes it more complex (e.g. the exponents of variables increase), unlike with derivatives where we are simplifying the function.
- Integrals don't usually make sense at single points, they are related to [intervals](interval.md). While with derivatives it's completely fine to ask "what's the derivative of this function at this single point", with integrals we always have to as "what's the integral between points A and B".
- As a consequence of the previous point there are TWO types of integrals: definite and indefinite.
- Related to the previous point is also the fact that derivative is basically a local operator concerned only with a single point and a small area around it, while integral is accumulating information over a bigger area, i.e. it's more complex in that we have to consider the function more globally.
- As another consequence of the non-local properties of integral there are actually TWO types of integrals: definite and indefinite.
- There exist quite simple functions that simply don't have an analytical solution (for example *sin(x)/x*).
So due to these complications we now yet have to explain the two different types of integrals:
- **indefinite integral**: This is the FUNCTION we get by performing integration, i.e. result of indefinite integral is a mathematical expression with variables in it. In fact this expression represents an infinite set of functions because it always has the additive constant *C* in it (like hinted above) -- we can kind of ignore this for now. The important gist is this: indefinite integral kind of gives us a general FORMULA that can further be used to compute definite integrals. For example an indefinite integral of function *f(x) = 1* will be *x + C*. In practice the result we are searching is often a definite integral (a single value), but to compute that we have to start by computing the indefinite integral.
- **indefinite integral**: This is the FUNCTION we get by performing integration, i.e. result of indefinite integral is a mathematical expression with variables in it. In fact this expression represents an infinite set of functions because it always has the additive constant *C* in it (like hinted above) -- we can kind of ignore this for now. The important gist is this: indefinite integral kind of gives us a general FORMULA that can further be used to compute definite integrals. For example an indefinite integral of function *f(x) = 1* will be *x + C*. In practice the result we are searching is often a definite integral (a single value), but to compute that we have to start by computing the indefinite integral. However it's also very hard to calculate indefinite integrals -- they are the precise solution and holy grail of integration but in practice we can't always get them and have to resort to approximations.
- **definite integral**: This is a single [NUMBER](number.md) which (applying the geometric interpretation of integral) tells us the AREA below the function graph (with area below zero counting as negative) over some specific INTERVAL, i.e. between two given points A and B. This means that definite integral doesn't give us an expression but rather a quantity. For example a definite integral of function *f(x) = 1* over interval [0,1] will give us 1 (imagine the graph: the area is simply that of a square with side 1). Definite integrals are computed from the indefinite integral by plugging the upper interval number into the indefinite integral (in the place of the variable), then plugging the lower interval number, and then subtracting the latter from the former. With numeric methods (computer integration) we always only get definite integrals (and actually only their approximate values) -- the computer here skips computing the indefinite integral (as that's hard) and rather like a dumb machine LITERALLY goes by small steps and computes the area below the function graph. Small note to this: the computer still can draw a graph of a function's integral by plotting definite integral value for interval 0 to *x* for every plotted *x* because when we think about it, the indefinite integral kind of gives us a function of how an indefinite integral grows; so the computer can give us a picture of a graph but it generally cannot give us an analytically computed formula of indefinite integral.
Fun fact: before digital computers engineers used very clever methods to find definite integrals of general functions. [Analog](analog.md) computers were particularly good at integrating, their continuous nature makes them a quite elegant solution to the problem, however perhaps even more genius method in its [simplicity](kiss.md) was the following: the engineer would draw the function he wanted to integrate on a sheet of paper, then cut it out and simply weight its mass -- this would give him the fraction of the weight of the whole sheet of paper and so also the fraction of the area below the function graph.
**Example**: we will now try to make an indefinite integral of the function:
*f(x) = 2 * x - 2*
@ -184,18 +190,6 @@ Now for the **notation**: the symbol for integral is kind of a big italic *S* ([
**Wait dude WHAT THE FUCK is this dx shit at the end?** This question is expected. Look: it has to do with the theory behind what the integral mathematically means, for starters one can just ignore it and remember that integral starts with *I*, then the integrated function follows, and then there is *dx* at the end. But to give a bit of explanation: firstly notice the *dx* tells us what the integrated variable is -- usually we have a function with single variable *x* and so it's pretty clear, but once we move to more dimensions we'll have more variables and this *dx* tells us what is a variable (i.e. along which axis we are integrating) and what is to be treated as a constant (maybe this doesn't yet make much sense but with integration there is a big difference between a variable and a constant, even if they are both represented by a letter). The real reason for *dx* is that the integral really represents an **infinite sum**. Have you ever seen that big sigma symbol for a sum? The integral symbol (here *I*) is like this, it likewise says "make an infinite sum of what will follow". But if we take a function and make infinitely many steps and keep summing the values the function gives us, we will just get [infinity](infinity.md) as the sum, so something is missing. In fact we don't want to sum the function values but rather areas of "tiny strips" we are kind of drawing below the function graph -- now a strip is basically a rectangle: area of a rectangle is computed as its height times its width. Height of the rectangle is the function value (here *2 * x - 2*) and width is *dx*, which represents the "infinitely narrow" interval. This is just to give some idea about WHY it looks like this, but it's cool to ignore it for now.
Here are some rules for integration:
| *f(x)* | *I f(x) dx* | comment |
| -------------------- | ----------------------------------------------------- | ---------- |
| *a * x^n* | *a * (x^(n+1))/(n+1) + C* | |
| *cos(x)* | *sin(x) + C* | |
| *sin(x)* | *-cos(x) + C* | |
| *e^x* | *e^x + C* | |
| *1/x* | *log(x) + C* | |
| *a * g(x) + b * h(x)*| *a * (I g(x) dx) + b * (I h(x) dx) + C* | |
| *g(x) * h(x)* | *g(x) * (I h(x) dx) - (I g'(x) * (I h(x) dx) dx) + C* | per partes |
So now the fuck we can finally move on. Our integral is really easy because it's just a sum of two expressions (and an integral of a sum thankfully equals a sum of integrals) that can be integrated easily. So from the rule *I x^N dx = x^(N + 1) / (N + 1)* we deduce that integral of *2 * x* is *2 * x^2 / 2 = x^2* and integral of *-2* is *-2 * x*, so we get:
*I (2 * x - 2) dx = x^2 - 2 * x + C*
@ -213,14 +207,26 @@ Now let's finish with computing a definite integral, OK? Let's say we want to co
Above we said this is done by computing indefinite integral (already done), then plugging the upper and lower bound and subtracting, so let's do it:
*I(0,1) (2 * x - 2) dx = (1^3 - 2 * 1 + C) - (0^3 - 2 * 0 + C) = -1*
*I(0,1) (2 * x - 2) dx = (1^2 - 2 * 1 + C) - (0^2 - 2 * 0 + C) = -1*
Things to notice here:
- The constants *C* nicely subtract and disappear, and they always will, so we don't have to worry about assigning them any values or stuff like that.
- The area we got is negative and its absolute size is 1, does this make sense? YES. Take a look at the graph of the function *2 * x - 2* up above and pay attention to the interval 0 to 1. The function's value is below zero and we said that area below zero will be negative, so this checks out. Also we can see that geometrically the size of the area is a half of a rectangle of height 2 and width 1, which is exactly 1. So all in all we're cool.
TODO: the rules
For completeness here are some rules for integration:
| *f(x)* | *I f(x) dx* | comment |
| -------------------- | ----------------------------------------------------- | ---------- |
| *a * x^n* | *a * (x^(n+1))/(n+1) + C* | |
| *cos(x)* | *sin(x) + C* | |
| *sin(x)* | *-cos(x) + C* | |
| *e^x* | *e^x + C* | |
| *1/x* | *log(x) + C* | |
| *a * g(x) + b * h(x)*| *a * (I g(x) dx) + b * (I h(x) dx) + C* | |
| *g(x) * h(x)* | *g(x) * (I h(x) dx) - (I g'(x) * (I h(x) dx) dx) + C* | per partes |
However note that applying these rules is generally not so simple as with differentiation, there exist methods such as *per partes* or *substitution* that don't tell you exactly how or when to apply them, so you have to experiment -- like said, this is an entertainment left to those who just enjoy doing math.
**Can we do higher order integrals and partial integrals?** Yes, of course, just like with derivatives we can do both of these.