How do I fix the Calculus.jl module

The calculus module is great for performing finite differences for derivative, jacobian and hessian

But when I tried to use it with my own type of floating point numbers, it fails and I track down why it fails.

julia> using PDFPs

julia> Base.float(x::PDFP) = x

julia> using Calculus

julia> Calculus.derivative( x->x^2 , PDFP(7) )  # returns 14
PDFP(0, 1, [1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

julia> Calculus.gradient(x -> sin(x[1]) + cos(x[2]), [PDFP(0), PDFP(0)])
2-element Array{Float64,1}:

Now Calculus.gradient return an Array of Float64 instead of Array of PDFP

I have track down the problem to
URL https : //


Now, I have ZERO experiences with github and I have no idea how to fix the issue.

There a two questions here:

  1. github and Pkg workflow: you will find many discussions on the forum, eg this one, and also general introductions to git online,

  2. regarding this particular problem: you could use T for the element type as a quick fix, but this may fail if finite_difference! widens. Then it would need to calculate the type. I have written

for this purpose, but the calculation is simple.


There’s a useful guide to gitting going with Julia and Github on Katie Hyatt’s blog.