Re: can Mathematica be useful for this?
- To: mathgroup at smc.vnet.net
- Subject: [mg56595] Re: can Mathematica be useful for this?
- From: Maxim <ab_def at prontomail.com>
- Date: Fri, 29 Apr 2005 03:22:07 -0400 (EDT)
- References: <d4kks5$eck$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Tue, 26 Apr 2005 05:51:01 +0000 (UTC), <pedrito6 at softhome.net> wrote:
> Hi there!
>
> I need to check the answer of many probability problems.
> Most of them are quite simple but calculating them by hand is tedious.
>
> They are like this:
> "It's necessary to choose a person for a mission overseas. If you choose
> him randomly the probability that he speaks a foreign languague is:
> S=Spanish; F=French; G=German
> P(S)=0.33; P(F)=0,26; P(G)=0.2;
> P(S and F)=0.15; P(F and G)=0.05; P(S and G)=0.1
> P(S and F and G)=0.02
>
> -What is the probability that he just speaks one foreign language?
> -What is the probability that he doesn't speak any?"
>
> Could be Mathematica useful for solving this kind of problems?
>
> Thanks for your help!
>
You can use the inclusion-exclusion principle:
In[1]:=
SetAttributes[p, Orderless]
p[] = 1.;
p[F] = .26;
p[G] = .2;
p[S] = .33;
p[F, G] = .05;
p[F, S] = .15;
p[G, S] = .1;
p[F, G, S] = .02;
In[10]:=
<<discretemath`
With[{n = 3},
Table[Sum[(-1)^(k - r)*Binomial[k, r]*
Total[p@@@ KSubsets[{F, G, S}, k]],
{k, r, n}],
{r, 0, n}]
]
Out[11]=
{0.49, 0.25, 0.24, 0.02}
This is the list of probabilities that the person knows exactly 0, 1, 2, 3
languages respectively.
Maxim Rytin
m.r at inbox.ru