The calculus package could definitely be much better if someone with 
knowhow and time would improve it. Unfortunately it seems like 
@johnmyleswhite <https://github.com/johnmyleswhite> does not maintain this 
package anymore, and nobody has taken up the ball. 


kl. 19:40:28 UTC+1 mandag 20. januar 2014 skrev Hans W Borchers følgende:
>
> I looked into the *Calculus* package and its derivative functions. First, 
> I got errors when running examples from the README file:
>
>     julia> second_derivative(x -> sin(x), pi)
>     ERROR: no method eps(DataType,)
>      in finite_difference at 
> /Users/HwB/.julia/Calculus/src/finite_difference.jl:27
>      in second_derivative at 
> /Users/HwB/.julia/Calculus/src/derivative.jl:67
>
> Then I was a bit astonished to see not too accurate results such as
>
>     julia> abs(second_derivative(sin, 1.0) + sin(1.0))
>     6.647716624952338e-7
>
> while, when applying the standard central formula for second derivatives,
> (f(x+h) - 2*f(x) + f(x-h)) / h^2 with the (by theory) suggested step 
> length eps^0.25 (for second derivatives) will result in a much better 
> value:
>
>     julia> h = eps()^0.25;
>
>     julia> f = sin; x = 1.0;
>
>     julia> df = (sin(x+h) - 2*sin(x) + sin(x-h)) / h^2
>     -0.8414709866046906
>
>     julia> abs(df + sin(1.0))
>     1.7967940468821553e-9
>
> The functions for numerical differentiation in *Calculus* look quite 
> involved, maybe it would be preferable to apply known approaches derived 
> from Taylor series. Even the fourth order derivative will in this case lead 
> to an absolute error below 1e-05!
>

Reply via email to