0
$\begingroup$

With the following function,

 PoissonBinomialSuccess[plist_, t_] := Flatten[With[{n = Length@plist, c = Exp[(2 I \[Pi])/(Length@plist + 1)]}, success = Probability[{k >= t}, k \[Distributed] (ProbabilityDistribution[Re[1/(n + 1) Sum[c^(-l k) Product[1 + (c^l - 1) plist[[m]], {m, 1, n}], {l,0, n}]], {k, 0, n, 1} ])]]] /; AllTrue[plist, 0 <= # <= 1 &]

I wish to populate a table with outputs by that function. For example, defining $plist$ and $t$ as shown below, I would like to create a table. The purpose is to create a 3D plot.

Edit / Clarification: I am only interested in the information that I have indicated by the square (so, the headings are unimportant). Also, the plists are vectors of homogeneous probabilities, that increment by some fixed magnitude. For example {0, 0, 0, 0, 0}, {0.1, 0.1, 0.1, 0.1, 0.1}, {0.2, 0.2, 0.2, 0.2, 0.2}, ... {1, 1, 1, 1, 1}.

For example, using @Bob Hanlon's approach below, the following is what I image. But I am very surprised that it appears problematic to display a 3D plot of the content:

TableForm[ table = Outer[PoissonBinomialSuccess[#1, #2][[1]] &, plist, tlist, 1]]

enter image description here

$\endgroup$
0

1 Answer 1

1
$\begingroup$

Look at documentation for Outer

PoissonBinomialSuccess[plist_, t_] :=
 Flatten[
   With[{
     n = Length@plist,
     c = Exp[(2 I π)/(Length@plist + 1)]},
    success = Probability[{k >= t},
      k \[Distributed] (ProbabilityDistribution[Re[1/(n + 1)* 
           Sum[
            c^(-l k)* 
             Product[
              1 + (c^l - 1) plist[[m]],
              {m, 1, n}],
            {l, 0, n}]],
         {k, 0, n, 1}])]]] /;
  AllTrue[plist, 0 <= # <= 1 &]

EDIT:

plist = ConstantArray[#, 5] & /@ Range[0, 1, .1];

tlist = Range[5];

TableForm[
 table = Outer[
   PoissonBinomialSuccess[#1, #2][[1]] &,
   plist, tlist, 1],
 TableHeadings -> {
   StringForm["plist=``", #] & /@ plist,
   StringForm["t=``", #] & /@ tlist},
 TableAlignments -> {".", Center}]

enter image description here

EDIT 2:

ListPlot3D[Table[
   {p, t, PoissonBinomialSuccess[ConstantArray[p, 5], t][[1]]},
   {p, 0, 1, .05}, {t, Range[5]}] // Flatten[#, 1] &,
 AxesLabel -> (Style[#, 12, Bold] & /@{"p", "t", "Success"})]

enter image description here

$\endgroup$
6
  • $\begingroup$ my aim is to create plist as lists of homogeneous probabilities that increments from 0 to 1. It doesn't look as if Tuples can help me do that. $\endgroup$
    – user120911
    Commented Apr 29, 2019 at 21:50
  • $\begingroup$ @user120911 - recommend that you edit your question to clarify how plist is defined. $\endgroup$
    – Bob Hanlon
    Commented Apr 29, 2019 at 22:22
  • $\begingroup$ I should have been more clear. My apologies. This answer is almost as I imaged. I imagined only the core part (without the headings), but again, I probably was not very clear about thaty either. I will edit my question, as you suggest. $\endgroup$
    – user120911
    Commented Apr 30, 2019 at 0:48
  • $\begingroup$ @user120911 - the "core" part is defined in the code as table. You can display it by table//Grid or table//MatrixForm $\endgroup$
    – Bob Hanlon
    Commented Apr 30, 2019 at 0:52
  • $\begingroup$ The following is exactly what I imaged. But I am very surprised that it is problematic to display a 3D plot of the content: TableForm[ table = Outer[PoissonBinomialSuccess[#1, #2][[1]] &, plist, tlist, 1]] $\endgroup$
    – user120911
    Commented Apr 30, 2019 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.