I have been looking on many different pages for a suitable Julia package to compute a similar (but more complicated) differentiation to the one below.
Say we have a function f(x)=5x[1]^4 - 2x[2]^2 is there a way to compute the partial derivative of this function with respect to x[1] say, but I would want the result in Julia gives simply as 20x[1]^3 to be used onwards in the code as the result would be if x[1] and x[2] were to be say x and y specifically?
I have looked into ForwardDiff as this deals with vector notation thus far but only encountered errors when implementing it. I am using the vector notation as x[1] and x[2] and the vector representations used later on in the code for the hcubature package for double integrations.
It seems like you're looking for something that can be handled by
Symbolics.jl. This snippet does what you're looking for:This will return
20(x[1]^3). You can use this as a symbolic expression in other equations. This resource shows how symbolic arrays are declared in Julia, and this one shows how theDifferentialoperator is used.