A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d6/d4a/addition__rule_8cpp.html below:

TheAlgorithms/C++: probability/addition_rule.cpp File Reference

Loading...

Searching...

No Matches

Addition rule of probabilities. More...

#include <iostream>

Go to the source code of this file.

Addition rule of probabilities.

Definition in file addition_rule.cpp.

◆ addition_rule_dependent() double addition_rule_dependent ( double A, double B, double B_given_A )

Calculates the probability of the events A or B for dependent events note that if value of B_given_A is unknown, use chainrule to find it \parama [in] A probability of event A \parama [in] B probability of event B \parama [in] B_given_A probability of event B condition A

Returns
probability of A and B

Definition at line 25 of file addition_rule.cpp.

25 {

26 return (A + B) - (A * B_given_A);

27}

◆ addition_rule_independent() double addition_rule_independent ( double A, double B )

calculates the probability of the independent events A or B for independent events \parama [in] A probability of event A \parama [in] B probability of event B

Returns
probability of A and B

Definition at line 14 of file addition_rule.cpp.

14 {

15 return (A + B) - (A * B);

16}

◆ main()

Main function

Definition at line 30 of file addition_rule.cpp.

30 {

31 double A = 0.5;

32 double B = 0.25;

33 double B_given_A = 0.05;

34

36 << std::endl;

37

38 std::cout << "dependent P(A or B) = "

40

41 return 0;

42}

double addition_rule_independent(double A, double B)

double addition_rule_dependent(double A, double B, double B_given_A)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4