Teep

130 Reputation

5 Badges

11 years, 324 days

MaplePrimes Activity


These are questions asked by Teep

Good day!

I wish to represent the flow across a network from a set of sources to a number of destinations or sinks.

In the simple example attached, there are 4 sources and 10 possible sinks. The flow from source to sink is given by the matrix, A, and each element is a binary entry; 1 for active and 0, otherwise. I would like to assign labels to each source (A,B,C,D) and sink (1,2,3,..., 9,10) and this feature will be most convenient for large matrices.The idea is to have these labels shown on the directed graph so that it is easy to see the flow configurations at a glance.

Does anyone know how this can be done?

Thanks in advance.

MaplePrimes_network_labels.mw

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

``

``


 

 

2 3 4 5 6 7 8 Page 4 of 8