octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestion - derivatives


From: Michael Creel
Subject: Re: Suggestion - derivatives
Date: Tue, 12 Oct 2010 08:47:48 +0200

On Mon, Oct 11, 2010 at 11:43 PM, Fotios Kasolis
<address@hidden> wrote:
> I suggest to include in Octave a function that calculates first
> derivatives/Jacobian matrix since optimization problems become of
> increasingly great importance. I am working on that and I have a weakly
> "optimized" finite difference routine using arbitrary stencils
>
> n = 9;
> h = 10^(-16/(n - 1));
> r = 0;
> A = ones (n);
> while (rcond (A) < eps)
>  x = x0 + [ -(n - 1)*h/2 : h : (n - 1)*h/2 ];
>  f = fun (x);
>  A_ = repmat (x(:), 1, n);
>  n_ = repmat (n - 1:-1:0, n, 1);
>  A = A_.^n_;
>  h = 2*h
> endwhile
> p = mldivide (A, f(:));
> dfdx = polyval (polyder (p), x0);
>
> I will also include the complex variable step derivative
>
> imag (fun(x0 + eps*1i)) / eps
>
> and finally for analytic functions I ll also implement the Cauchy's
> integration + fft method which I posted earlier and provides higher
> derivatives as well. Any other method that someone thinks is of interest and
> importance (other than the adjoint)? What do you think about this? Is this
> sth that should be included in Octave or?
>
> /Fotios
>
>

Hi Fotios,
There are first and second derivative functions in Octave Forge,
numgradient and numhessian, which are in the optimization package. You
might like to check your code against them for speed and accuracy.
Best,
Michael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]