Items tagged with probability


I'm wondering if there is an available command that can evaluate the number of terms required to produce a desired outcome.

Specifically, I am interested in determining the probability of a Poisson distribution, given the parameter (mean) value and the probability outcome. I can obtain the desired result using trial and error / brute force, but I am curious to know if there is a more efficient way. 

Suppose that, lambda = 2.6 and the cumulative sum of the probabilities is 95%. I know that I must add the first 6 terms for P(x) in the series (x=0,1, ..,5) to sum to 0.95. Each term ...  P(x=0)= 0.07, P(x=1)=0.19, and so on.

However, how can we know that desired 95% outcome can be determined from the first 5 terms without trial & error?

Dear All,

I would like to plot the probability density function of a state variable obtained from solving differential equations. I have found that there are functions called "PDF" and "KernelDensityPlot" in the Statistics package, but they really confuse me. Could you please point me out? My code is as follows.

Ps. Is it possible to plot the PDF directly from the solution of dsolve() without discretizing the results? 

with(plots): with(DEtools): with(plottools):with(LinearAlgebra): with(Statistics):

v1:=1: f:=-4: v2:=2.515: omega:=1: epsilon:=0.001: k:=0:

t_start:=50: t_end:=300: dt:=0.05: fs:=1/dt:

solA:=dsolve({sys, u1(0)=0.6, u2(0)=0.6, z(0)=0.1},
              type=numeric, method=rkf45, maxfun=0,
              output=Array([seq(i,i=t_start..t_end, dt)])):




# How could I plot the probability density of Phi (y-axis) against Phi(x-axis)?

Thank you!

Very kind wishes,

Wang Zhe

Let us consider 

U := RandomVariable(DiscreteUniform(-10, 10)):
V := RandomVariable(DiscreteUniform(-10, 10)):
Probability(U^2-V^2 <= 1/9, numeric);

, whereas a positive number greater than 1/21 is expected. 


I didn't even know the erf function existed until doing this problem. I looked up how to use it, so I tried plugging in the explicity form into Maple, hoping it'd solve it, but it just spit back out the erf function.

I am trying to get a number answer.  A decimal. Because this is calculating a probability. How do I get Maple to give me a number here? Thanks!

Let us consider 

Statistics:-Mode(Binomial(n, p));
                        floor((1 + n) p)

Up to Wiki, the output is not correct. Simply no words.

restart; with(Statistics):
X := RandomVariable(Normal(0, 1)): Y := RandomVariable(Uniform(-2, 2)):
Probability(X*Y < 0);

crashes my comp in approximately 600 s. Mma produces 1/2 on my comp in 0.078125 s.

I am trying to find the optimal routing probabilities in a Maple procedure where the Mean Value Analysis is used to compute the queueing values. The Maple code is below. It first tries to compute the visit ratios where the probability routing values are the decision variables. There is one specified constraint on the sum of the probability decision variables.


interface(warnlevel=0): interface(displayprecision = 4): with( plots ):
with(linalg):with( Optimization ); with(Student[NumericalAnalysis]):
[ImportMPS, Interactive, LPSolve, LSSolve, Maximize, Minimize,

NLPSolve, QPSolve]
global T,lambda,nq,u;
local i,j,pop,Sum;
# Gauss-Seidel iterations
b:= Vector([1,0,0]);
v := IterativeApproximate(LinearAlgebra:-Transpose(A), b, initialapprox = Vector([1, 3/4, 3/4]), tolerance = 10^(-3), maxiterations = 20, stoppingcriterion = relative(infinity), method = gaussseidel);
nq:=array(1..M,[0,0,0]);# must initialize queue lengths
for i from 1 to N do

for j from 1 to M do # mean waiting times
T[j]:=t[j]*(1 + nq[j]) od;
Sum := 0.0;
for j from 1 to M do # mean cycle time
Sum := Sum + v[j]*T[j] od;
for j from 1 to M do #compute the throughputs
lambda[j] := (v[j]*pop)/Sum od;
for j from 1 to M do #compute the queue lengths
nq[j]:= lambda[j]*T[j] od;
for j from 1 to M do #compute the utilizations
u[j]:= lambda[j]*t[j] od;
end proc;

proc(x1, x2, x3) ... end;


sol := Optimization:-NLPSolve(f, {}, {proc (x1, x2, x3) options operator, arrow; x1+x2+x3-5/3 end proc}, 0 .. 1, 0 .. 1, 0 .. 1, initialpoint = [.75, .25, .6667], assume = nonnegative); 1;

Error, (in Optimization:-NLPSolve) non-numeric result encountered


I am not sure why I get the error message



When defining a plain standard distributed stochastic variable X, and can find the probability of X <= 0.6 using the Probability function, but how can I get the value for a certain probability, as is done with the fsolve function for example below.

However, the fsolve used to defined Prev above appears to be a bad way to do it, since the Prev function can't for example plot.

Is there some build in way of doing reverse of Probability for a stocastical variable ?

Hei, I'm trying to create a random walk in the plane, with constant step length (=1) and the angle between two consecutive steps are decided by a probability density function. I just can't seem to find out how I should implement the density function into my worksheet.

The probability density function is: p(phi)=(1/4)*cos(phi/2), on the interval [-Pi,Pi].
And  I think i managed to do it by selecting a random angle, but don't know how to generate a random angle given this probability function. Any ideas? It'd be highly appreciated!

In this code I'm trying to separately normalize two independent probability densities and then combine them to get the joint probability density that's normalized and then use it to calculate the probability that the two variables are equal. fD(x) is a Gaussian divided by x^2 and fA(x) is a Gaussian. The first problem occurs when I'm checking the normalization of the joint probability density by doing the double integral over all space for fD(x)*fA(y)dxdy, I get weird vanishing number when the parameter "hartree" takes a certain value, namely 27.211. If I change hartree to 27 or 1 or 2 it all worked, but 27.211 is not good. Also later when I do a single integral over all space for fD(x)*fA(x)dx to get the probability that these two are equal, I find the result is dependent on hartree. This hartree thing is a unit conversion in my physical problem and in principle should not interfere with either the normalization or the probability result at all. I suspect this is a coding bug but I can't find what it is. I'd appreciate any input.

Thank you very much!


Edit: I found out that the problem with the double integral normalization may have something to do with the discretization for numerical evaluation of the integral, since if I change the lower bound to 1/hartree and upper to 10/hartree then it's fine, however if I use lower bound at 1/hartree and upper at 5/hartree it doesn't work, although the distribution has no value between 5/hartree and 10/hartree. However after this is fixed I still have the problem with the single integral over all space for fD(x)*fA(x)dx changing with hartree. Well as a probability I would expect the integral to be bound between 0 and 1, but since it almost linearly depends on hartree, at hartree around 27 I would get the integral value to be about 25, which doesn't make sense. In fact, I now suspect it is not Maple, but my calculation of the probability of the two random variables taking the same value is wrong, I'd appreciate it very much if someone can confirm this.

I'm drawing a complete blank on this. 

The probability of a branch breaking in a particular tree as someone climbs is 2%.  After the person has climbed over 40 branches, did any of them break?  I'm trying to set that up as a simulation in Maple but I'm not sure about how to do it. 

I guess if I generate a random number and it falls under .02 it breaks, is that how I determine that?


n := 0;
for i to 40 do
ran := evalf(rand()*10^(-12));
if ran < 0.2e-1 then n := n+1: end if:
end do:
print("Branch broke", n, "times")

I'm not sure I've got the probability right.


What is the probability that the total of two dice will be greater than 9, given that the first die is a 5?


Please I want to know how to solve this integration.


int(exp(-(ln(y)-2*sigma^2)^2/(8*sigma^2))/(y*sqrt(8*Pi*sigma^2))*exp(-(ln(y+z)-2*sigma^2)^2/(8*sigma^2))/((y+z)*sqrt(8*Pi*sigma^2)), y = 0 .. infinity)

How  can you create a loop for Monty Hall Problem when you have 3 door (1 opening) and then 4 Doors (with 2 openings and possible 2 switches)




I need help formulating a biased coin toss.


I want to toss a coin 0 being heads and 1 being tails with probabilty 0.495 of getting heads, how do I show whether heads or tails wins??



1 2 3 Page 1 of 3