In R, both symbolic differentiation vs computational graph are implemented. Suppose we want to calculate the gradient of function f(x, y)=sin(x + y2). First, let’s look at symbolic differentiation: Next is the code for computational graph: We can see that the results are the same.