Compute a function that has Double summation
10 次查看(过去 30 天)
显示 更早的评论
I want to compute . I have tried with code
Q1 = @(n) (1/alpha_3b)^(n + 2) * (1/alpha_1)^2 * ...
(sum((alpha_3b/alpha_1).^(1:10000)) * sum((alpha_3b/alpha_3).^(1:n+1)) - ...
sum(sum((alpha_3b/alpha_3).^i .* (alpha_3b/alpha_1).^(1:n+1-i))));
but am getting error.
The other values are
lambda = 0.7;
mu_1=1.2;
mu_2=1;
mu = mu_1 + mu_2;
gamma_1 = 0.2;
gamma_2 = 0.3;
theta_1 = 0.2;
theta_2 = 0.1;
eta = 0.1;
xi = 0.01;
beta = 1 / (lambda + mu + xi);
beta_1 = 1 / (lambda + mu_1 + xi);
beta_2 = 1 / (lambda + mu_2 + xi);
alpha_1 = (lambda + mu_2 + theta_1 + xi + sqrt((lambda + mu_2 + theta_1 + xi)^2 - 4 * lambda * mu_2)) / (2 * lambda);
alpha_2 = (lambda + mu_1 + theta_2 + xi + sqrt((lambda + mu_1 + theta_2 + xi)^2 - 4 * lambda * mu_1)) / (2 * lambda);
alpha_3 = (lambda + mu + xi + sqrt((lambda + mu + xi)^2 - 4 * lambda * mu)) / (2 * lambda);
alpha_3b = (lambda + mu + xi - sqrt((lambda + mu + xi)^2 - 4 * lambda * mu)) / (2 * lambda);
chi_1 = gamma_1 * alpha_1 / ((lambda + xi) * alpha_1 - lambda * mu_2);
chi_2 = gamma_2 * alpha_2 / ((lambda + xi) * alpha_2 - lambda * mu_1);
0 个评论
回答(2 个)
KALYAN ACHARJYA
2023-12-4
Q1 = @(n) (1/alpha_3b)^(n + 2) * (1/alpha_1)^2 * ...
(sum((alpha_3b/alpha_1).^(1:10000)) * sum((alpha_3b/alpha_3).^(1:n+1)) - ...
sum(sum((alpha_3b/alpha_3).^i .* (alpha_3b/alpha_1).^(1:n+1-i))))
lambda = 0.7;
mu_1=1.2;
mu_2=1;
mu = mu_1 + mu_2;
gamma_1 = 0.2;
gamma_2 = 0.3;
theta_1 = 0.2;
theta_2 = 0.1;
eta = 0.1;
xi = 0.01;
beta = 1 / (lambda + mu + xi);
beta_1 = 1 / (lambda + mu_1 + xi);
beta_2 = 1 / (lambda + mu_2 + xi);
alpha_1 = (lambda + mu_2 + theta_1 + xi + sqrt((lambda + mu_2 + theta_1 + xi)^2 - 4 * lambda * mu_2)) / (2 * lambda);
alpha_2 = (lambda + mu_1 + theta_2 + xi + sqrt((lambda + mu_1 + theta_2 + xi)^2 - 4 * lambda * mu_1)) / (2 * lambda);
alpha_3 = (lambda + mu + xi + sqrt((lambda + mu + xi)^2 - 4 * lambda * mu)) / (2 * lambda);
alpha_3b = (lambda + mu + xi - sqrt((lambda + mu + xi)^2 - 4 * lambda * mu)) / (2 * lambda);
chi_1 = gamma_1 * alpha_1 / ((lambda + xi) * alpha_1 - lambda * mu_2);
chi_2 = gamma_2 * alpha_2 / ((lambda + xi) * alpha_2 - lambda * mu_1);
While there are no coding errors in given code, however the verification of correctness and completeness has not been checked?.
0 个评论
Torsten
2023-12-4
编辑:Torsten
2023-12-4
All the series involved are geometric series for which the finite and infinite sums are known:
sum_{i=1}^{i=n} q^i = q * (1-q^n)/(1-q) ( q <> 1)
sum_{i=1}^{i=Inf} q^i = q/(1-q) (|q| < 1)
Thus if you invest a little effort, you can get an analytical expression for Q1(n):
syms alpha_3b alpha_1 alpha_3 positive
syms m n i j integer
assume(abs(alpha_3b/alpha_1)<1)
s1 = symsum((alpha_3b/alpha_1)^j,j,1,Inf)
s1 = alpha_3b/(alpha_1-alpha_3b); % By inspection
s2 = symsum((alpha_3b/alpha_3)^m,m,1,n+1)
s3 = symsum((alpha_3b/alpha_1)^j,j,1,n+1-i)
s4 = symsum(s3*(alpha_3b/alpha_3)^i,i,1,n)
Q1 = simplify((1/alpha_3b)^(n+2)*(1/alpha_1)^2*(s1*s2-s4))
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Gamma Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!