help-octave
[Top][All Lists]
Advanced

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

Re: How to use a returning vector function inside another returning vect


From: Colin Macdonald
Subject: Re: How to use a returning vector function inside another returning vector function ?
Date: Mon, 31 Jul 2017 10:42:15 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 2017-07-31 07:54 AM, Adhanedhel wrote:
                Norm = norm((G(x+epsi*dx,z)-G(x-epsi*dx,z))/(2*epsi) - 
dG(x,z)*dx)

At the end of this line, dG and dx are both vectors so "*" gives an error.

Perhaps you mean "norm(dG(...))*norm(dx)"? Or an inner product like "(dG')*dx", or "dot(dG, dx)", or ... etc

To me, it looks like you are trying to compare the finite difference to the directional derivative. One approach:

  dirderiv = ... % exercise for reader
  finitediff = G(x+epsi*dx,z)-G(x-epsi*dx,z))/(2*epsi);
  Norm = norm(finitediff) - norm(dirderiv)

best,
Colin



reply via email to

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