Teep

195 Reputation

5 Badges

16 years, 156 days

MaplePrimes Activity


These are questions asked by Teep

LP_Matrix.pdf

Hello!

I'm missing something basic here, I'm sure, and would love to know how to proceed.

I have extracted solutions to a particular optimization problem using LPSolve and have obtained the binary solutions in matrix form, for matrices, say .. X and Y.

The solutions are obtained using the routine in the attached pdf; these outputs are sufficient for the basic problem.

Now, I wish to use directed graphs to illustrate the solutions, so I need to take the output matrices to draw the graphs. However, I cannot seem to find a way to do this. The solutions are given, in this case, by 'X' and 'Y'. 

Can anyone advise me on how to extract the matrices that can be used to draw the graphs using with(Graph Theory)?

Thanks in advance ...

I have a question that concerns visualising the output of a simple matrix. For instance, take a 4 x 10 matrix in the example attached (rows are denoted by i and columns, j) with entries either 0 or 1. This gives the on/off relationship between any i and j. Let i and j denote 2-dimensional locations whose coordinates are known. The matrix gives the connections (1's) between both locations; 0's otherwise.

Can Maple output a map that visually represents the connections between nodes?

In the example here, I wish to plot location 2 (in i) connected to location 3 (in j), location 3 (in i) connected to location 1 (in j), and so on. Can I output a plot / map that presents the nodes with radiating / connecting arrows?

I'm hoping someone can help, since the matrix form is not quite appealing for a large number of entries.

 

Thanks for reading!
 

restart

A := Matrix(4, 10, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (1, 7) = 0, (1, 8) = 0, (1, 9) = 0, (1, 10) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 1, (2, 4) = 1, (2, 5) = 0, (2, 6) = 1, (2, 7) = 0, (2, 8) = 0, (2, 9) = 0, (2, 10) = 1, (3, 1) = 1, (3, 2) = 1, (3, 3) = 0, (3, 4) = 0, (3, 5) = 1, (3, 6) = 0, (3, 7) = 1, (3, 8) = 1, (3, 9) = 1, (3, 10) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (4, 6) = 0, (4, 7) = 0, (4, 8) = 0, (4, 9) = 0, (4, 10) = 0})

 

``


 

Download Matrix_Plot_Question.mw

 

I wish to write a simple procedure to evaluate the Poisson quantile function, F, for many possible parameter values, lambda.

The Maple commands to evaluate F for individual lambda values works just fine, however, I have tried to write a simple procedure to evaluate F for prescribed lambda values (imported from Excel) but to no avail. I'm missing something quite basic, I'm sure.

Can anybody offer a suggestion please? Thanks.

 

Inverse_Poisson_Procedure.mw

 

Given any threshold value, I am interested in obtaining a quantity of interest using the inverse negative binomial distribution. This requires extracting the value from the discrete CDF and I am using the Quantile(X, threshold value) function.

The parameters of the NBD are given as r and p and the routine I have written (attached) works in some cases, but I have noticed that, for small values of p, the Maple program runs for excessive times to attempt to output the Quantile solution. For instance, if p = 0.3, the solution is fast but when p = 0.003, Maple continues to evaluate the solution with no result (I have interrupted computations after 2 hours).

In the attached example, p is set to 1.965 and r is 0.5. The threshold value is 0.98 and the associated solution, Q, for this value is determined to be Q=7.

Does anybody know how to help with this? I would be grateful for any help along the way. 


 

restart; with*Statistics; with(plots)

r := 1.965; p := .5

1.965

 

.5

(1)

with(Statistics)

R := RandomVariable(NegativeBinomial(r, p))

ProbabilityFunction(R, u)

Set the value of the CDF probability, α.

Evaluate the inverse CDF to return the quantity of interest, Q.

 

alpha := .98

.98

(2)

X := NegativeBinomialVariable(r, p); X := RandomVariable(NegativeBinomial(r, p))

CumulativeDistributionFunction(X, alpha)``

Q := Quantile(X, alpha)

7.

(3)

DensityPlot(X, title = "PDF")

 

plot(CDF(X, s), title = "CDF")

 

``

``NULL

``

``


 

 

I'm hoping somebody can help with this problem.

The Poisson Loss Function is defined by the series:

L := sum((n-s)*lambda^n*exp(-lambda)/factorial(n), n = s .. infinity)

Where lambda is the mean value that is prescribed and s is the variable in question.

Now, if the value of L is given, can anyone tell me how to solve for  s?

Poisson Distribution Loss Function Tables are available and give values for s for a given lambda, so I's like to see if Maple can handle this.

 

Thanks for reading!

First 6 7 8 9 10 11 12 Page 8 of 12