Numerical differentiation is by far not as unstable as you seem to think.
And I have a long experience in using numerical derivatives for 
optimization problems where you don't stop to look up symbolic derivatives 
applying a CAS.
The function obviously was only an example.
For most of the functions I have used Julia's symbolic capabilities will 
not be sufficient.


On Monday, January 20, 2014 9:07:02 PM UTC+1, Jason Merrill wrote:
>
> This implementation could certainly use some love, but finite difference 
> differentiation is always unstable, and the situation gets worse as you 
> take higher order derivatives.
>
> You might want to consider using the differentiate method to take your 
> derivatives symbolically (if this works for the functions you're using), or 
> have a look at the differentiation example in PowerSeries.jl. To do a 
> symbolic second derivative, you can do, e.g.
>
> julia> using Calculus
> julia> @eval d2(x) = $(differentiate(differentiate(:(sin(x)))))
> julia> d2(1.0)
> -0.8414709848078965
>  
>

Reply via email to