Answer the question

In order to leave comments, you need to log in

A

A

Alexey Poloz2018-09-22 14:33:06

Is it possible to calculate this mathematical expression with a sum without using a loop using Python tools?

There is a mathematical expression from the MatLab problem book:

Is it possible to calculate this mathematical expression with a sum without using a loop using Python tools? I saw a method using vectors, but I couldn’t implement it, since placement is also used in this formula.

Answer the question

In order to leave comments, you need to log in

2 answer(s)

@sgjurano

@Trif

V

Vladimir Olohtonov, 2018-09-23 @sgjurano

UPD: further reasoning is wrong.

And what is the number of combinations of a negative number?

C_{n}^{k} = n!/(nk)!k!, the factorial is defined only for natural numbers and zero, and in your expression k runs from -n to n, which means that for any n except 0, this expression is not defined.

From this we can conclude that it is defined only for n=0, then:

sum_{k=-n}^{n}[((-1)^{nk} * C_{n}^{k})/(xk )] = (-1^0 * (0!*0!/0!)/x = (1 * 1)/x = 1/x

D

Dmitry, 2018-09-23 @Trif

Perhaps I misunderstood the question (I clarified in the comments), but if everything is taken literally, to solve such a problem, I would use something like this:

```
from math import factorial as fact
def sigma(n,x):
if abs(x) in range(abs(n)+1):
raise ValueError('check the arguments values ')
else:
return sum(
[(-1)**(n-k)*fact(2*n)/fact(n+k)/fact(n-k)/(x-k)
for k in map(lambda i: i-n, range(2*n+1))]
)
```

Similar questions

E

B

A

E

Didn't find what you were looking for?

Ask your questionAsk a Question

731 491 924 answers to any question