# Vectorizing a summation

**URL:** <https://discourse.julialang.org/t/vectorizing-a-summation/117435>\
**Category:** New to Julia\
**Tags:** broadcast\
**Created:** [July 24, 2024, 6:03pm UTC](https://discourse.julialang.org/t/vectorizing-a-summation/117435 "2024-07-24T18:03:22Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 24, 2024, 6:29pm UTC](https://discourse.julialang.org/t/vectorizing-a-summation/117435/3 "2024-07-24T18:29:53Z")

</div>

On a separate note, this is a very inefficient way to sum a series like this. You are recomputing the `binomial` factor and powers like `c[k]^p` separately for each loop iteration, when in practice you can compute them much more efficiently using a recurrence relation from the previous term.

See e.g. [Sinc function - and sinc neural networks - and function approximation for the former - #4 by stevengj](https://discourse.julialang.org/t/sinc-function-and-sinc-neural-networks-and-function-approximation-for-the-former/46483/4)

---

_[View the full topic](https://discourse.julialang.org/t/vectorizing-a-summation/117435)._
