I would like to pack binomial functions with different parameters in a list. Here the binomial functions are defined as follows:

px[x_, k_, n_] := 1 - \!\(\*UnderoverscriptBox[\(\[Sum]\), \(i = 0\), \(k\)]\(Binomial[n, i] x^i\ \((1 - x)\)^\((n - i)\)\)\)

py[y_, k_, n_] := \!\(\*UnderoverscriptBox[\(\[Sum]\), \(i = 0\), \(k\)]\(Binomial[n, i] y^\((n - i)\)\ \((1 - y)\)^i\)\)

When n is given, I need to find a list

{(1/2)(px[x, k, n]+py[y, k, n]):k=0,1,...,n-1}

For example if n=2

{(1/2)(px[x, 0, 2]+py[y, 0, 2]),(1/2)(px[x, 1, 2]+py[y, 1, 2])}

and for n=3

{(1/2)(px[x, 0, 3]+py[y, 0, 3]),(1/2)(px[x, 1, 3]+py[y, 1, 3],(1/2)(px[x, 2, 3]+py[y, 2, 3])}


How can Mathematica do this automatically for me when I just give the value of $n$? So I am looking forwards to obtaining a list of functions, each of which is dependent on two variables $x$ and $y$

  • $\begingroup$ It might be better to ask your questions one at a time $\endgroup$ – mikado Sep 27 '18 at 22:06
  • $\begingroup$ @mikado I agree but I just had the idea that both questions are quite related and if one can answer the second one, which is actually the one that I am looking for, he/she would also be able to answer the first one. $\endgroup$ – Seyhmus Güngören Sep 27 '18 at 22:09
  • $\begingroup$ BernsteinBasis[] is built-in, so you could just do e.g. py[y_, k_, n_] := Sum[BernsteinBasis[n, i, y], {i, 0, k}]. $\endgroup$ – J. M. is in limbo Sep 28 '18 at 0:42
  • $\begingroup$ @J.M.issomewhatokay. And where can I use this? I am not able to create the lists still.. Maybe I must separate this question into two. $\endgroup$ – Seyhmus Güngören Sep 28 '18 at 14:13
  • $\begingroup$ The question is now separated in to two and other part can be found here: mathematica.stackexchange.com/questions/182773/… $\endgroup$ – Seyhmus Güngören Sep 28 '18 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.