Having problem with a infinite double sum
Afficher commentaires plus anciens
I'm having a problem trying to code this infine double sum

A, b, x, y and q0 are known values. My problem is specificaly tryind to transform that double sum in a code.
3 commentaires
Lucas Resende
le 4 Avr 2022
Torsten
le 4 Avr 2022
Just out of curiosity: Which PDE does the above sum solve ?
Lucas Resende
le 5 Avr 2022
Réponse acceptée
Plus de réponses (1)
You might want to try a numerical solution:
a = 2.0;
b = 4.0;
nu = 20;
q0 = 1.0;
X = linspace(-2*pi,2*pi,250);
Y = linspace(-2*pi,2*pi,500);
eps = 1e-5; % precision of series evaluation
tic
for i = 1:numel(X)
for j = 1:numel(Y)
Z(j,i) = func(a,b,nu,q0,X(i),Y(j),eps);
end
i
end
toc
[XX,YY] = meshgrid(X,Y) ;
surf(XX,YY,Z)
function fvalue = func(a,b,nu,q0,x,y,eps)
total_sum = 0.0;
diagonal_sum = 1.0;
i = 1;
if abs(nu) >= 1
while abs(diagonal_sum) > eps
J = 1:i;
diagonal_sum = sum((((2*J-1)/a).^2/nu + ((2*(i-J)-1)/b).^2)./...
((2*J-1).*(2*(i-J)-1).*(((2*J-1)/a).^2 +...
((2*(i-J)-1)/b).^2).^2) .*...
sin((2*J-1)*pi*x/a).*sin((2*(i-J)-1)*pi*y/b));
total_sum = total_sum + diagonal_sum;
i = i + 1;
end
total_sum = nu*total_sum;
else
while abs(diagonal_sum) > eps
J = 1:i;
diagonal_sum = sum((((2*J-1)/a).^2 + nu*((2*(i-J)-1)/b).^2)./...
((2*J-1).*(2*(i-J)-1).*(((2*J-1)/a).^2 +...
((2*(i-J)-1)/b).^2).^2) .*...
sin((2*J-1)*pi*x/a).*sin((2*(i-J)-1)*pi*y/b));
total_sum = total_sum + diagonal_sum;
i = i + 1;
end
end
fvalue = 16*q0/pi^4*total_sum;
end
Catégories
En savoir plus sur Calculus dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!