Results of Newton-Raphson method to find the root ?

Hi,
I need to solve the following equation by using Newton-raphson method :
a. f(lambda)=-z'*inv(M)*inv(W)*Q*inv(W)*inv(M)*z,
W=inv(M)+lambda*Q
f'(lambda)=z'*inv(M)*inv(W)*(Q^2*inv(W)+inv(W)*Q^2)*inv(W)*inv(M)*z
Q and W are complex square matrices ,also z and M are metrices .
I wrote a code to find the root by Newton's method ,but the value of the root is complex ,but it must be real.I am not sure a bout the derivative of f(x).
I have another form to the function f(x) ,but I don't know if it's suitable to be solved by Newton's method in matlab,the other form is:
m gamma_k*|x_k|^2
b. f(lambda)=sum -----------------------
k=1 (1+lambda(gamma_k))^2
m (gamma_k)^2*|x_k|^2
f'(lambda)= 2* sum --------------------------
k=1 (1+lambda(gamma_k))^3
where gamma_k is sub indices , gamma is eigenvalue
m is total number of eigenvalues of T=(M)^(1/3)*Q*(M)^(1/2)
x=U'*M^(-1/2)*z ,U is eigen vectors of T.
Is this form in (b) of equation suitable to be solved by Newton Raphson method.
The code for form (a):
delta=1e-12;
epsilon=1e-12;
max1=500;
lambda=-1/(2*gamma);
for k=1:max1
zeta=cos(theta);
I=eye(n,n);
Q=zeta*I-p*p';
W=inv(M)+lambda*Q;
y1=2*z'*inv(M)*inv(W)*Q.^2*inv(W)*inv(M)*z;
y=-z'*inv(M)*inv(W)*Q*inv(W)*inv(M)*z;
p1=lambda-y/y1;
err=abs(p1-lambda);
lambda=p1
if (err<delta)
break
end
k
err
end

7 Comments

Is the derivative with respect to lambda ?
Your formula ia "a." has MWQM, but your formula for y has MWQWM ?
A rough calculation I just did suggests that the derivative with respect to lambda would be close to the form you have, but probably with only one of the inv(W). At least that is how it would be if the variables involved were scalars instead of matrices.
The derivative is with respect to lambda ,I have re-corrected the formula in (a).The derivative with respect to lambda is different a little bit ,so if you look at the other formula in (b) ,you will notice that.I have edited the thread and I wrote the derivative of the the two formula ,but I can not simplified the dervative for (a) because the variables are matrices except lambda should be a real singular value,but I have applied it in the code ,but the result is complex with error :
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 2.047863e-016.
What about the formula in (b) is it applicable .Can anybody help
Duplicate postings will be deleted. Even on New Years Day.
I am sorry ,but I need to remind just only.How can I represent the form in(b) matlab.Also I need to plot the function to select the most correct initial guess,can any body help.
The form of your equation (a) is surprising. I would expect something more like
f(lambda)=-z'*inv(M)*inv(W)*Q*W*M*z,
for which the answer is more likely to be real.
In (b), the denominator is missing a right parenthesis, so its interpretation is ambiguous.
I fixed the equation of form (b) it.Just I need to represent it in matlab

Sign in to comment.

 Accepted Answer

Are you able to find the eigenvalues and eigenvectors of T? If so, then (b) should be straight-forward to code (though perhaps tedious.)
plot the real and imaginary parts of solutions on the same graph, but in different colors or symbols. Use "hold on" and plot each complex point as it is generated. Newton's method will move back and forth on x values, so it is probably best not to attempt to connect the solutions with lines until after all the solutions have been generated, after which you would sort based on the x coordinate.

3 Comments

I have found the the eigenvalues and eigenvectors of T,But I don't know how to represent (b) it in matlab ,if it's easier than the form in (a).
I have tried to plot the function in (a) ,but it gives an empty figure
with yhe following message :
Warning: Imaginary parts of complex X and/or Y arguments ignored.
lambda=-3.6535e-001 +1.8718e-014i ,as you noticed the imaginary part is very little compared with the real part.I don't know what to do.
X = Something;
plot(X, real(lambda), 'r*', X, imag(lambda), 'bs');
If gamma_k is the list of eigenvalues, then
flambda = 0;
for K = 1 : length(gamma_k)
flambda = flambda + gamma_k(K) * x_k(K) / (1+lambda(gamma_k(K)))^2;
end
and likewise for f' .
However, I cannot tell from what you have posted what x_k is. I also cannot tell whether lambda(gamma_k) is intended to indicate multiplication or something else.
There might be vectorized ways of calculating f(lambda), but that is going to depend on what lambda(gamma_k) and x_k mean.
I don't recognize what X mean.
x_k :z'*inv(M)*U ,U is eigenvectors
lambda*(gamma_k) is muliplication
gamma-k is eigen value

Sign in to comment.

More Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!