Re: UI Question / Threading
- To: mathgroup at smc.vnet.net
- Subject: [mg78473] Re: [mg78423] UI Question / Threading
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Mon, 2 Jul 2007 06:59:28 -0400 (EDT)
- References: <9860934.1183292495089.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
Or this:
Needs["Histograms`"]
iterate[outer_, inner_] := Block[{many = {}, few, i, j},
For[j = 1, j <= outer, j++,
For[few = {}; i = 1, i <= inner, i++,
few = {few, Eigenvalues@RandomReal[{0, 10}, {2, 2}]}];
many = Partition[Flatten@{many, few}, 2];
plots =
GraphicsRow@{Histogram[many[[All, 1]],
PlotLabel -> "N = " <> ToString[inner*j]],
Histogram[many[[All, 2]]], Histogram3D[many]}
]
]
First run a small simulation:
Dynamic@plots
iterate[3, 4]
Click on the GraphicsRow output, grab the lower-right corner, and expand
the graphic to fit your screen.
Then run a larger simulation and watch the original output graphic:
iterate[50, 50]
You can also specify the ImageSize:
iterate[outer_, inner_, imageSize_] := Block[{many = {}, few, i, j},
For[j = 1, j <= outer, j++,
For[few = {}; i = 1, i <= inner, i++,
few = {few, Eigenvalues@RandomReal[{0, 10}, {2, 2}]}];
many = Partition[Flatten@{many, few}, 2];
plots =
GraphicsRow[{Histogram[many[[All, 1]],
PlotLabel -> "N = " <> ToString[inner*j]],
Histogram[many[[All, 2]]], Histogram3D[many]},
ImageSize -> imageSize]
]
]
Experiment with small simuls until you have everything looking the way you
want:
Dynamic@plots
iterate[3, 4, 600]
Then do the longer run:
iterate[50, 50, 650]
Bobby
On Sun, 01 Jul 2007 06:43:15 -0500, jbaker75 at gmail.com
<jbaker75 at gmail.com> wrote:
> Hi -
>
> I would like to do the following simple task, but cannot find out how
> to do it. I would like to create a simple UI in mathematica that
> updates itself on a regular basis. For example, I spawn a process that
> computes the eigenvalues of a "random" matrix. I do this 1000 times.
> If the matrix is large, this may take some time in a single thread.
> Rather, while I do this, I would like to update a graphic showing the
> density of states..., i.e. a histogram of the eigenvalues. I would
> like to update regularly, say every fifty experiments.
>
> Can anyone point me in the right direction?? I am using Mathematica
> 6.0. But also have 5.2 as well.
>
> Thank you!
> Jeff Baker
>
>
>
--
DrMajorBob at bigfoot.com