Solving an equation with terms that require double summation and products

I need to solve the following equation.
Opt.JPG
I wrote the following code based on the above equation, but I believe I have made a mistake as the final answer is large.
I have attached the *.mat file for reference.
Any assistance would be much appreciated.
% Condition number for the optimal distribution of the hole-drilling depth increments, base on the "Integral Method" for the non-uniform hole-drilling residual stress measurement technique
% Determination of the condition number for the optimal distribution of the hole-drilling depth increments,
% base on the "Integral Method" for the non-uniform hole-drilling residual stress measurement technique.
% The following equation as referenced from this source (see below) is used
% for this determination.
% https://link.springer.com/article/10.1007/BF02331114
% Develop the terms of the equation
% The individual terms of the equation will be developed individually and then brought together.
% Loading the files
% Loading the required variables.
% Loading of the required *.mat file and then the variable.
anp = load("191231_GS_0295_10.mat","aij");
aij = anp.aij
% Length of array
N = length(aij)
% Summation of matrix
aij_2 = aij^2
y1 = sum(aij_2(:))
% Product of the matrix
aii = diag(aij)
aii_2 = aii.^2
% Product of the square of the diagonal of the matrix
y2 = 4*prod(aii_2,"all")
% The complete equation is as follows:
K_A = (y1 + (y1.^2-y2).^0.5)./y2

 Respuesta aceptada

David Goodmanson
David Goodmanson el 20 de En. de 2020
Editada: David Goodmanson el 20 de En. de 2020
Hi GS,
I reproduced your results and then calculated the equation using for loops, just to make sure, and got 1.8767e37, same as the second way. Anyway,
aij_2 = aij^2
can't really be correct since it squares the entire matrix as a matrix product, but both
aij_2 = aij.^2
and the for loop way of doing things proceed element-by-element.
Such a large result as 10^37, is that expected? The expression depends on the scaling of the matrix, i.e. if every element in the matrix were multiplied by 2, the result would be different. If the result is supposed to be a dimensionless condition number, I would think there would have to be some kind of normalization done on aij before using the expression that you have.
Here's Matlab cond:
cond(aij)
ans = 51.3232

9 comentarios

Hi David,
Thank you for your reply.
I have also checked the condition number and that is exact what I get.
I am not sure if the number should be that large.
Perhaps I should make contact with the author of the paper?
Do you know how to generate a lower triangular matrix with a constant diagonal coefficients?
I forgot to add that I could then use the new matrix through this equation.
If the number you are referring to is the 10^37 one, there is no way that could be useful as a condition number except to tell you that the matrix is singular. My understanding of of condition numbers is that they should not change if the entire matrix is multplied by a constant. If aij is multiplied by m, then for an NxN matrix, y1 scales like m^2 and y2 scales like m^(2*N). The final result depends on m. If the values of aij are greater than 1, pretty soon the result becomes is complex. Something is not right with that expression.
n = 10;
a = 2;
m = rand(n,n);
m = m -diag(diag(m)) + a*eye(n,n);
m = tril(m)
Thanks David!
I see what you mean. The output is complex.
I will discuss with the author.
I appreciate your excellent explanation.
Thank you.
Hi GS, if you are able to talk to the author, I would be interested in what the resolution of this is.
Hi David,
I will let you know.
Thank you for the interest.
Hi David,
Just to confirm, besides the fact that the equation may be incorrect, have I implemented the "double summation" and the product series correctly in the code?
Thanks.
GS
Hi GS, the code looks good, although I think replacing ^0.5 with sqrt looks cleaner, and you don't need N
aij_2 = aij.^2;
y1 = sum(aij_2(:))
aii = diag(aij);
aii_2 = aii.^2;
y2 = 4*prod(aii_2);
K_A = (y1 + sqrt(y1^2-y2))/y2
I probably would have used
y1 = sum(sum(aij_2))
just by personal preference, since it emphasizes that there is a 2d sum, but that's neither here nor there.
Incidentally, abbreviating the supposed condition number K_A by c, then c is one of the solutions to the quadratic
y2*c^2 - 2*y1*c + 1 = 0
I wonder what that means?
Thank you for your valued response and confirmation of my maths.
I like you thinking with regards the quadratic equation! The paper discusses the "minimising" the condition number.
Unfortunately, no response from the author as of yet.

Iniciar sesión para comentar.

Más respuestas (1)

David Goodmanson
David Goodmanson el 19 de En. de 2020
Editada: David Goodmanson el 19 de En. de 2020
Hi GS, try
aij_2 = aij.^2
Since y1 and y2 are scalars, there are three dots in the last equation that you can drop. I usually do this because it's neater and provides an extra clue to what the variables are. That's a net savings of two dots, which you can use in another equation sometime.

1 comentario

Hi David,
Thank you for your input.
So for the above code, K_A = 6.1743e37.
And for the follwoing code as you suggested (I hope I got it right), K_A = 1.8767e37.
I am going to look into this further as I believe I am not getting the "double summation" and "product" of this series correct.
%% Condition number for the optimal distribution of the hole-drilling depth increments, base on the "Integral Method" for the non-uniform hole-drilling residual stress measurement technique
%% Introduction
% Determination of the condition number for the optimal distribution of the
% hole-drilling depth increments, base on the "Integral Method" for the non-uniform
% hole-drilling residual stress measurement technique.
%
% The following equation as referenced from this source (see below) is used
% for this determination.
%
% <https://link.springer.com/article/10.1007/BF02331114 https://link.springer.com/article/10.1007/BF02331114>
%
%% Develop the terms of the equation
% The individual terms of the equation will be developed individually and the
% brought together.
% Loading the files
% Loading the required variables.
% Loading of the required *.mat file and then the variable.
anp = load("191231_GS_0295_10.mat","aij");
aij = anp.aij
%%
% Length of elements
% Length of array
N = length(aij)
% Double summation
% Summation of matrix
aij_2 = aij.^2
y1 = sum(aij_2(:))
% Product
% Product of the matrix
aii = diag(aij)
aii_2 = aii.^2
% Product of the square of the diagonal of the matrix
y2 = 4*prod(aii_2,"all")
%% Complete equation
% The complete equation is described as follows:
%
%
% The complete equation is as follows:
K_A = (y1 + (y1^2-y2)^0.5)/y2

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Productos

Versión

R2019b

Preguntada:

el 19 de En. de 2020

Comentada:

el 22 de En. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by