# Calculate plausibility in Dempster-Shafer theory

I want to use Mathematica to show which subsets of a power set are required to calculate the plausibility for a given set in a power set. This has lead me to compute a summation with a Do and an If function in Mathematica. I would like to know if there is a neater way.

The plausibility $$pl(A)$$ is the sum of all the masses of the sets B that intersect the set of interest A:

$$pl(A) = \sum_{B|B \cap A \ne \emptyset}^{ } {m(B)}$$

This is based on the Wikipedia example https://en.wikipedia.org/wiki/Dempster%E2%80%93Shafer_theory.

To calculate summation I used the following Mathematica code:

Do[If[Intersection[{r},i]!={},Print[i]],{i,powerset}]
powerset = Subsets[{r,y,g}]


This returns:

{{},{r},{y},{g},{r,y},{r,g},{y,g},{r,y,g}}


If I want to calculate the plausibility of 'Red' then I need to sum the masses of the following sets:

Do[If[Intersection[{r},i]!={},Print[i]],{i,powerset}]

This returns:

{r}
{r,y}
{r,g}
{r,y,g}


Is there a better way I can get Mathematica to return this list of sets?

From your code, you appear to be looking for subsets in the power set that contain a certain symbol. That's a job for Selector Cases:
Select[Subsets[{r, y, g}], MemberQ[r]]

{{r}, {r, y}, {r, g}, {r, y, g}}

• Maybe a silly question, but wouldn't all sets of Subsets[{r,y,g}] that have r in it be just the same as Subsets[{y,g}] with r appended to each subset? – Sjoerd Smit Apr 18 at 14:35