I’m totally new in Julia. Now, I’m working on derivative. I found that ‘2nd derivatives’ (ex. function derivative_sec_fd(f,x)), but still couldn’t find how to do partial derivative…

Could you tell me which command should I use?

# How to do partial derivatives?

**Lucy929**#1

**crstnbr**#3

Related (maybe xref?): https://stackoverflow.com/questions/54277219/partial-derivatives-in-julia

**crstnbr**#4

You could use automatic differentiation to calculate partial derivatives of a function

```
julia> using ForwardDiff
julia> f(x) = 2*x[2]^2+x[1]^2 # some function
f (generic function with 2 methods)
julia> g = x -> ForwardDiff.gradient(f, x); # g is now a function representing the gradient of f
julia> g([1,2]) # evaluate the partial derivatives (gradient) at some point x
2-element Array{Int64,1}:
2
8
```