Gradient approximation with bilateral triangle

This is a comment about the video about numerical approximation of gradients.

It includes an interesting comparison between unilateral and bilateral approximations to the gradient, where the centered triangle is twice as wide as the unilateral version, 2\epsilon vs. \epsilon. But we don’t need to enlarge the triangle, we may simply shift it.

In this case, if a width \epsilon was used, we would get

\frac{f\left(\theta+\frac{\epsilon}{2}\right) - f\left(\theta-\frac{\epsilon}{2}\right)}{\epsilon}

The numerical result would be 3.000025, a little bit closer to 3 (although of the same order) and farther from the unilateral version.

Hi Jaume_Oliver_Lafont,

Thanks for this valid point that may be useful to future learners!