> # Maple worksheet to demonstrate use of Ph(t)/Ph(t)/Infinity procedures

> # from Nelson and Taaffe (1999). Last update 6/30/99.

> with(linalg):

> A := matrix(3,3,[.2,.1,.7, .4,.2,.4, .8,.2,0.]);

[Maple Math]

> lambda := vector(2,[7.,9.]);

[Maple Math]

> B := matrix(3,3,[0,1,0, 0,0,1, 0.3, 0.7, 0]);

[Maple Math]

> mu := vector(2, [2+sin(t), 2+sin(t/2)]);

[Maple Math]

>

> # Evaluate the moment differential equations at time t = 5

> read(`PhPhInfNumericEmpty`):

> mdeq := PhPhInfNumericEmpty(A, lambda, B, mu);

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

> mdeq(5);

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

>

> # show the moment differential equations for this queue starting empty and idle

> read(`PhPhInfSymbolic`):

> PhPhInfSymbolic(A, lambda, B, mu);

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

>

> # compute the mean and variance of number in the queue for 0 < t < 50

> # (the mean and variance appear to be the same for this example)

> read(`PhPhInfMoments`):

> PhPhInfMoments(A, lambda, B, mu, 0, 50);

[Maple Plot]

>

> # compute the mean, variance and cdf of the sojourn time of a customer

> # arriving at time 5

> read(`c:PhPhInfNumericInit`):

> read(`PhPhInfSojourn`):

> sojourn := PhPhInfSojourn(A, lambda, B, mu, 5):

> sojourn[1]; # mean

[Maple Math]

> sojourn[2]; # variance

[Maple Math]

> sojourn[3]; #cdf

[Maple Plot]

>

>

> # Create initial conditions that correspond to 1 customer in the queue and no new arrivals

> InitP := vector(2, [0,0]);

[Maple Math]

> InitN := vector(2, [.3, .7]);

[Maple Math]

> InitNN := vector(2):

> InitNN[1] := matrix(2,2, 0);

[Maple Math]

> InitNN[2] := matrix(2,2,0);

[Maple Math]

> InitNA := matrix(2, 2, [0,0,0,0]);

[Maple Math]

> # create a procedure to evaluate the moment differential equations with these

> # initial condition in place at time t = 5

> mom := PhPhInfNumericInit(A, lambda, B, mu, 5, InitP, InitN, InitNA, InitNN);

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

> mom(5);

[Maple Math]
[Maple Math]
[Maple Math]

> mom(10);

[Maple Math]
[Maple Math]
[Maple Math]

>