Solve equation that contains sum analitically

조회 수: 4 (최근 30일)
Mihajlo Novakovic
Mihajlo Novakovic 2016년 11월 24일
댓글: Walter Roberson 2016년 11월 24일
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

답변 (2개)

Roger Stafford
Roger Stafford 2016년 11월 24일
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'.

Walter Roberson
Walter Roberson 2016년 11월 24일
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
Roger Stafford
Roger Stafford 2016년 11월 24일
@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’.
Walter Roberson
Walter Roberson 2016년 11월 24일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by