From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Newton_radhson method
Date: Mon, 2 Jan 2012 02:16:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <jdr418$fbi$>
References: <jdo0jc$6g1$> <jdo75c$p09$> <jdq618$km9$> <jdqo2o$c07$> <jdqvs4$44b$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1325470568 15730 (2 Jan 2012 02:16:08 GMT)
NNTP-Posting-Date: Mon, 2 Jan 2012 02:16:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:753531

"zayed " <> wrote in message <jdqvs4$44b$>...
> "Roger Stafford" wrote in message <jdqo2o$c07$>...
> >   Hence, given the above three conditions, you could conclude that y is always real.  With complex values in Q (and possibly M) you may obtain very tiny imaginary parts for y due to round off error in actual computation, but you can then legitimately use only its real part by writing y = real(y). .....

> Thanks a lot Roger  for your explanation it's useful.I derived the derivative of the function :
> THE DERIVATIVE     y1=2*z'*inv(M)*inv(W)*Q*inv(W)*Q*inv(W)*inv(M)*z;
> THE FUNCTION          y=-z'*inv(M)*inv(W)*Q*inv(W)*inv(M)*z;
> And the results is a complex numbers with a very small imaginary part ,also M,Q and W are Herimitian , is is column vector (real) ,Also the eigenvalues of T is complex with very little imaginary part.but the value of lambda is complex number with negative real part and very small imaginary part ,but lambda have to be real number and greater that zero ,Is this might be from the initial guess.
- - - - - - - -
  With perfect computation and perfectly Hermitian matrices along with real initial values of y, the computed values of y and its derivative, y1, as well as the eigenvalues of T would be real-valued.  That is true in the ideal error-free mathematical world.

  However, as I hinted to you in my last posting, you are necessarily doing your computation with less than perfect accuracy on a real-world computer.  The binary floating point quantities you are using in these computations are only accurate out to about the sixteenth decimal place (52 bits) relative accuracy.  We have no way of representing all possible numbers with perfect accuracy because that would require infinitely many bits.

  Given this inaccuracy and the fact that complex quantities are involved, it is inevitable that you will obtain small imaginary parts to y, y1, and the eigenvalues of T.  Their real parts will also be in error by similarly small amounts.  This cannot be avoided.  The sizes of these erroneous imaginary parts and the errors in the real parts will depend on the kinds of round off errors that are occurring, but with typical situations I would expect them to be roughly like a relative value of 1e-12 or thereabouts in relation to the sizes of the real parts, perhaps somewhat larger if your matrices are not well conditioned.  You might try experimenting with the Symbolic Toolbox using extremely high accuracy, say 100 digits, to get a feel for the sizes of these errors.

  If you are satisfied that these non-zero imaginary parts are just due to round off errors, you should simple discard them and use only the real parts.  As I said, do y = real(y) and similarly with the eigenvalues of T.

Roger Stafford