JuliaMath / JuliaMath/Calculus.jl

analytic Jacobian

Open
#94 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
285
Forks
78
PR merge metrics
No merged PRs in 30d

Description

i wrote counterparts to the existing `finite_difference_jacobian` for the case where the function of interest is analytically differentiable. happy to submit a PR if there is interest. would just need to know the best place to put it.

```
function analytic_jacobian{T<:Number}(fdot::Vector{Function}, x::Vector{T})
f_x = fdot[1](x)
J = Array(Float64,length(f_x),length(x))
J[:,1] = f_x
for i = 2:length(fdot)
J[:,i] = fdot[i](x)
end
J
end

"""
`jacobian(fdot::Vector{Function}) -> g(x::Vector)`

Given a function `f` whose partial derivatives are `fdot`, return a function
`g(x)` which itself returns the Jacobian of `f` at `x`.
"""
function jacobian(fdot::Vector{Function})
g(x::Vector) = analytic_jacobian(fdot, x)
return g
end
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.