MATLAB: Sum up just the even terms of a series

series

Hello! I would like to have the sum of a series, for example 1/p, with p being even. The sum of the series is till to infinity , thats why I have difficulty. To clarify my question, I want to add
sum= 1/2 + 1/4 + 1/6 + 1/ 8 + ……………..
I worked with the symsum but I couldnt find a way to ask just the sum of the even terms. Thank you very much in advance!

Best Answer

Make the change of indices p=2*k and sum over k=0,1,2,...,Inf.
So, for your example
sum_{p even} (1/p) = sum_k 1/(2*k)
= 1/2 *sum_k(1/k)
= Inf
Related Question