How to solve following equation in matlab
1 view (last 30 days)
Show older comments
Hi all, please see the attached figure which is my equation I am trying to solve using Matlab.
I have the code using syms function (see below). I believe f6 should yield final result for me but instead it shows something of the following kind. I used functions like 'vpa' and 'simplify' but still cannot yield answer. See f6 first and then the code
f6 = (3884161996073403*symsum((5^jj*symsum((-1)^(jj - m)/factorial(jj - m), m, 0, jj))/factorial(jj), jj, 0, Inf))/576460752303423488
The Code is as follows
clc;
clear all;
close all;
Pc = 45-30;
Pc_lin = 10^(Pc/10);
Po = 3-30;
Po_lin = 10^(Po/10);
lambda_m = 6e-6
alpha_l = 2;
alpha_o = 4;
varepsilon_2 = 0.5;
Xd = 5;
% T_mj = e^(-K)*K^j*(1/(factorial(j) * factorial(j-m)) )
beta = (2*pi/alpha_o)/sin(2*pi/alpha_o);
syms jj m
K = 5;
T = -5;
T_lin = 10^(T/10);
Cd = pi*(T_lin*varepsilon_2*Xd^alpha_l)^(2/alpha_o)*(lambda_m*(Pc_lin/Po_lin)^(2/alpha_o))*beta;
A = Cd*T_lin^(2/alpha_o);
B = exp(-1*Cd*T_lin^(2/alpha_o));
% T1
syms jj m z ii
f1 = (-1)^(jj-m)/(factorial(z-ii)*factorial(ii)) * gamma(2*ii/alpha_o)/gamma(2*ii/alpha_o-(jj-m)+1)
f2 = symsum(f1, ii, 1, z)
f3 = symsum(f2,z,1,jj-m);
f4 = (-1)^(jj-m)*exp(-K)*K^jj/(factorial(jj)*factorial(jj-m))
f5 = symsum(f4, m, 0, jj)
f6 = symsum(f5, jj,0,inf)
2 Comments
Walter Roberson
on 12 Feb 2018
You are not necessarily doing anything wrong. A lot of symbolic summations do not have known closed form solutions. I cannot read your image clearly, but with what I see, I speculate that you might not be able to do better than a solution that replaces one of the summations with a hypergeom call, and I am not certain that is possible.
Answers (1)
Walter Roberson
on 13 Feb 2018
f6_35 = double(sum(subs(f5,jj,0:35)))
gives as precise an answer in double precision as going to 200 does.
5 Comments
Walter Roberson
on 13 Feb 2018
It works for me when I test in R2015b. For clarity I am testing with
Pc = 45-30;
Pc_lin = 10^(Pc/10);
Po = 3-30;
Po_lin = 10^(Po/10);
lambda_m = 6e-6
alpha_l = 2;
alpha_o = 4;
varepsilon_2 = 0.5;
Xd = 5;
% T_mj = e^(-K)*K^j*(1/(factorial(j) * factorial(j-m)) )
beta = (2*pi/alpha_o)/sin(2*pi/alpha_o);
syms jj m
K = 5;
T = -5;
T_lin = 10^(T/10);
Cd = pi*(T_lin*varepsilon_2*Xd^alpha_l)^(2/alpha_o)*(lambda_m*(Pc_lin/Po_lin)^(2/alpha_o))*beta;
A = Cd*T_lin^(2/alpha_o);
B = exp(-1*Cd*T_lin^(2/alpha_o));
% T1
syms jj m z ii
f1 = (-1)^(jj-m)/(factorial(z-ii)*factorial(ii)) * gamma(2*ii/alpha_o)/gamma(2*ii/alpha_o-(jj-m)+1)
f2 = symsum(f1, ii, 1, z)
f3 = symsum(f2,z,1,jj-m);
f4 = (-1)^(jj-m)*exp(-K)*K^jj/(factorial(jj)*factorial(jj-m))
f5 = symsum(f4, m, 0, jj)
f6_35 = double(sum(subs(f5,jj,0:35)))
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!