Solve equation that contains sum analitically

Hi all,
I need to solve an equation that contains summation analytically. Is that possible in matlab.
Equation is
k*exp(-k*t)*sum(exp(i*n*t))+sum((i)*exp((i*n*t))-exp(-k*t)*sum((i)*exp(i*n*t))=0
for t where i goes from 1 to n.
Thanks in advance

Answers (2)

With an appropriate use of the 'symsum' function, you can transform the summations in your expression into one without summations. Solving the result will involve either the use of 'solve' or 'fsolve', or even 'fzero'.
You appear to be missing a ')' related to the second sum()
I would guess you want
syms k t i n
eqn = k*exp(-k*t)*(symsum(exp(i*n*t), i, 1, n)) + symsum(i*exp(i*n*t), i, 1, n) - exp(-k*t) * (symsum(i*exp(i*n*t), i, 1, n)) == 0;
T = solve(eqn, t)
The eqn has a closed form representation. The solve() will fail as there is no closed form solution for solving the sum of exponentials, not even if you provide specific k and n values.

2 Comments

@Walter. Actually there is a closed form for these particular summations. For example symsum(i*exp(i*n*t),i,1,n) is of the form
symsum(k*x^k,k,1,n)
where x = exp(n*t) which is equal to:
x*(x^n*(n*(x-1)-1)+1)/(x-1)^2
Also symsum(exp(i*n*t),i,1,n) is of the form symsum(x^k,k,1,n) where again x = exp(n*t) which is equal to:
x*(x^n-1)/(x-1)
This means that Mihajlo’s expression can be put in a closed form without any symsum’s and therefore solved in the usual way with either ‘solve’, ‘fsolve’, or ‘fzero’.
As I indicated, the eqn has a closed form -- which is a sum of exponentials. The sum of exponentials cannot be solved analytically: it is
((((k-n)*exp(n*t)-k+n+1)*exp(-k*t)+n*exp(n*t)-n-1)*exp((n+1)*n*t)-(-1+(k*exp(n*t)-k+1)*exp(-k*t))*exp(n*t))/(exp(n*t)-1)^2 == 0
and solve() of it leads to
RootOf(k*exp(-k*Z/n+2*Z)-k*exp(-k*Z/n+Z)-k*exp(Z-Z*(-n^2+k-n)/n)+n*exp(Z-Z*(-n^2+k-n)/n)-n*exp(Z*n+2*Z)+exp(-k*Z/n+Z)+k*exp(-Z*(-n^2+k-n)/n)-n*exp(-Z*(-n^2+k-n)/n)+exp(Z*n+Z)*n-exp(Z)-exp(-Z*(-n^2+k-n)/n)+exp(Z*n+_Z), Z)/n
where RootOf(f(Z), Z) indicates the set of values such that f(Z) becomes 0.
When I tossed in a couple of random positive values for k and n, I found two real solutions for the root, one at t = 0; a quick check with some graphing suggests that there might possibly be an infinite number of complex-valued solutions.

Sign in to comment.

Asked:

on 24 Nov 2016

Commented:

on 24 Nov 2016

Community Treasure Hunt

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

Start Hunting!