Sum of series (infinity upper limit), only want odd number

13 views (last 30 days)
I am trying to compute this function:
Were all the parameters are constant values, except for z and y which are known vectors. I guess I could use symsum function, but I don´t know how to specify that I only want odd value of the parameter n.
Any suggestions?

Accepted Answer

Walter Roberson
Walter Roberson on 23 Sep 2021
syms N y h w z
Pi = sym(pi);
symsum(1/(2*N-1) * (1 - cosh((2*N-1)*Pi*y/h)/cosh((2*N-1)*Pi*w/(2*h))) * sin((2*N-1) * Pi * z/h), N, 1, inf)
ans = 
except for z and y which are known vectors
Be careful when using symbolic expressions and vectors. What does it mean to divide one vector by other for your purposes? You have to be careful with the multiplication too -- the part inside [] is a vector the same size as y, and the sin() is a vector the same size as z, but is algebraic matrix mutliplication implied?
  1 Comment
Federica Miano
Federica Miano on 23 Sep 2021
Hi Walter, thanks for your answer.
When computing the code that you wrote, the answer is still:
ans =
-symsum((sin((z*pi*(2*N - 1))/h)*(cosh((y*pi*(2*N - 1))/h)/cosh((w*pi*(2*N - 1))/(2*h)) - 1))/(2*N - 1), N, 1, Inf)
as symsum is not making the calculation. I don´t understand where is the problem.
Also, even if the function depends on both z and y, I just need to know v(z) and v(y) for a fixed value of y and z respectively. So I wrote this code:
But still it doesn´t work. This is the answer I get:
>> Untitled
v_x(y) =
piecewise(n in Dom::ImageSet((k*1i)/10000 + 1/2, k, Z_), -(2904959969109679*sin((pi*(2*n - 1))/2)*(Inf/cosh((9*pi*(2*n - 1))/5) - Inf))/(9007199254740992*(2*n - 1)^3), ~n in Dom::ImageSet((k*1i)/10000 + 1/2, k, Z_), -(2904959969109679*sin((pi*(2*n - 1))/2)*(limit(exp(-10000*pi*y)*exp(-20000*pi*n*y)*(exp(20000*pi*n)*exp(20000*pi*y) - exp(10000*pi)*exp(40000*pi*n*y)), y, Inf)/(exp(10000*pi) - exp(20000*pi*n)) - Inf*cosh((9*pi*(2*n - 1))/5) - 1))/(18014398509481984*cosh((9*pi*(2*n - 1))/5)*(2*n - 1)^3))
v_x(z) =
piecewise(in(10000*n, 'integer'), 0, ~in(10000*n, 'integer'), -(2904959969109679*(limit(- (exp(-pi*z*10000i)*exp(pi*n*z*20000i)*1i)/(2*(exp(pi*n*20000i) - 1)) + (exp(pi*z*10000i)*exp(-pi*n*z*20000i)*1i)/(2*(exp(-pi*n*20000i) - 1)), z, Inf) + ((exp(pi*n*20000i) + 1)*1i)/(2*(exp(pi*n*20000i) - 1)))*(1/cosh((9*pi*(2*n - 1))/5) - 1))/(9007199254740992*(2*n - 1)^3))

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!