## 90 Reputation

14 years, 292 days

## Kruskal's Algorithm for finding a Minimu...

One thing I enjoy is implementing algorithms in Maple. The latest thing I worked on was Kruskal's Algorithm for finding a minimum spanning tree in a connected and weighted graph. It was something we covered in my summer math class which covered topics in discrete math. Here is a link to the algorithm in the application center: http://www.maplesoft.com/applications/app_center_view.aspx?AID=2133 I believe I have implemented the cycle-detection correctly; but I think there is likely a more efficient way. I may update it later if I come up with a better way.

## Graphing discrete points...

The last point I would make about the dice problem; is to mention a way to graph the probabilities ... as n increases.

Given that the following function determines the probability of all faces being shown when n dice are rolled (from previous work):

> P := n -> 1 - ((add((-1)^(k+1)*binomial(6,k)*(6-k)^n,k=1..5))/(6^n));

## Solving the dice problem with the combin...

Let's continue on with the dice example; determining the probability of all faces showing when n dice are thrown.   We estimated this by running a simulation in maple; and comparing the frequency of successes to the total number of experiments.

There is a way to determine the probability without running trials. The problem can be solved combinatorially.

One way to determine the probability of all faces shown; is to determine the the probability that all faces are NOT shown (call this probability B). Then the probability that all faces are shown = 1 - B.

## Using the set data type can simplify log...

Let's take another look at the dice rolling example:

Simulate rolling 8 dice 10 times.

roll := rand(1..6);
for i from 1 to 10 do;
dice := ['roll()' \$8]; # dice contains 8 random values, each from 1..6
end do;

Let's say you want to check the list "dice" to see if all faces are
represented.

One way to do this is to write a proc which creates an array indexed
1..6; and initialize the array to zero; and then check the dice list ...
incrementing the associated array index for each value in the dice list.
Finally ... check the built array to see if all index values are non-zero.

## Hello from Jay...

Hi, This is Jay Pedersen; a student a UNO in Omaha, NE. I have been using Maple for several years; and I appreciate its power to solve problems and I use it as a programming platform for solving mathematical problems. Here is a simple example: Simulate rolling 8 dice 10 times. roll := rand(1..6); for i from 1 to 10 do; dice := ['roll()' \$8]; # dice contains 8 random values, each from 1..6 end do; I plan to submit an application shortly which determines the minimal sum for a boolean expression (in sum of products form (eg: abc + a' + bd'). All for now. -Jay
 1 2 Page 2 of 2
﻿