This commit is contained in:
Miloslav Ciz 2025-01-16 23:00:49 +01:00
parent 2efc415ac4
commit 70c10acfc5
61 changed files with 1970 additions and 1954 deletions

View file

@ -67,7 +67,7 @@ Here it is shown graphically:
```
tangent / __
line / .' ''..
/ __.'f(x)
/ __.'f(x)
/-''
/|
__../:|dy
@ -113,7 +113,7 @@ Its graph looks like this:
:| :
3 + :
|: :
2 + '.._..'
2 + '.._..'
|
1 +
|
@ -129,7 +129,7 @@ To differentiate this function we only need to know (from the table above) that
So *x^2* became *2 * x*, *-2 * x* became just -2 (because *x^0 = 1*) and *3* just disappeared (this always happens to additive constants -- notice that such constants don't affect the function's slope in any way, so that's why). The graph of the derivative looks like this:
```
|
|
2 + /
| /
1 + /
@ -272,7 +272,7 @@ double integral(double (*f)(double), double x)
steps--;
x += DX;
}
return flip ? -1 * r : r;
}
@ -293,7 +293,7 @@ int main(void)
for (int i = 0; i < GRAPH_RESX * GRAPH_RESY; ++i)
graphImage[i] = (i % GRAPH_RESX) == GRAPH_RESX / 2 ? ':' :
((i / GRAPH_RESX) == GRAPH_RESY / 2 ? '-' : ' ');
// now plot the function, its derivative and integral
for (double x = -1 * GRAPH_SIZE; x < GRAPH_SIZE;
x += GRAPH_SIZE / (2 * GRAPH_RESX))
@ -301,7 +301,7 @@ int main(void)
graphDraw(x,integral(f,x),'#');
graphDraw(x,derivative(f,x),'*');
graphDraw(x,f(x),'x');
}
}
// draw the graph:
for (int i = 0; i < GRAPH_RESX * GRAPH_RESY; ++i)