Symbolic differentiation vs computational graph in R

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.

Calculate derivatives using symbolic differentiation in R

In base R, there is a function “deriv” from stats library to compute derivatives of simple expressions, symbolically and algorithmically. Here I use another function “Deriv” from Deriv library. To calculate both gradient and hessian matrix of a two-variable function: Then evaluate the value at point (2, 0) : To calculate the directional derivative ofContinue reading “Calculate derivatives using symbolic differentiation in R”

Build a contour plot using outer product function and plotly in R

Happy new year! Today I would like to share with you how I build a contour plot using outer product function and plotly in R. Consider the Rosenbrock banana function: The following R code uses outer function in R to build the contour of Rosenbrock function. And here is the graph:

Introduce Yourself (Example Post)

This is an example post, originally published as part of Blogging University. Enroll in one of our ten programs, and start your blog right. You’re going to publish a post today. Don’t worry about how your blog looks. Don’t worry if you haven’t given it a name yet, or you’re feeling overwhelmed. Just click theContinue reading “Introduce Yourself (Example Post)”

Create your own website, free on WordPress.com.Create your own website.
Start free