Reputation: 301
I am trying to define I function which I will derivate later and the function is
syms i q j
syms f(i,q)
f=symsum(((1-q)^(i-j))*j*q,j,0,i)
The f
I get shows me 4 terms but in fact I do not know this number. Is it correct or how do I enter this correctly?
Upvotes: 1
Views: 346
Reputation: 797
First of all, please don't use i
and j,
because they correspond to the imaginary unit; that causes misunderstandings.
syms N q k
syms f(i,q)
f=symsum(((1-q)^(N-k))*k*q,k,0,N)
piecewise(q == 0, 0, q ~= 0, (q + N*q - q*(1 - q)^N + (1 - q)^N - 1)/q)
The result is a piecewise, and it says that the result is 0 if q
is 0, and otherwise the formula given on the right.
You can also evaluate Sum[(1 - q)^(M - k) k q, {k, 0, M}]
with WolframAlpha, where you get the same result. As you see, your formula can be written without the sum. You get the derivative with D[Sum[(1 - q)^(M - k) k q, {k, 0, M}],q]
on WolframAlpha.
Upvotes: 3