@williamsnieves, we cover graphs more in the âAlgebra and Equationsâ section of the course, which includes a lecture on how to find the gradient (or slope) of a line.
For this lecture though, hereâs an example of how to do it using your example of âx = 4â
First up, you want to sample two points that are close to x = 4 (the closer the better).
So we could take x = 3.9 and x = 4.1
We can then find the âyâ values for both of these points.
So for the function 2^x, this would be 2^3.9 = 14.9 and 2^4.1 = 17.1
Now to relate this back to the triangle we drew under the curve, the side that follows the x-axis has the length of 4.1 - 3.9 = 0.2
And the side that follows the y-axis has the length of 17.1 - 14.9 = 2.2
With all that out of the way we can now find the slope of the curve, which is the change in y, over the change in x - or more simply, slope = rise / run.
This gives us 2.2 / 0.2 = 11 and we have our answer.
I hope that explains how to find the rate of change, but as to where you can use this in games, it depends on the type of problem that youâre trying to solve.
If you knew an objects position over time, you could use this type of differentiation to work out the velocity of the object.
Or in this case, if you know the objects speed over time then you can work out the objects acceleration.
Game engines do tend to give you access to nice helper methods for some of these queries but it can be good to get a feel for the math that goes on behind the scenes. Maybe youâre trying to work out the best values for some variables and rather than doing the old guess and check, you can do a quick bit of math to get to your answer quicker.