Prev: partial derivate of a function of vector variable
Next: Fourier transform of exponential function
From: Janos Turelem on 25 Mar 2010 05:22 Dear All, I am new to Mathematica and I am trying to handle a list which updates dynamically (at the end of this email you will find an example of the code). This gives me an error, since the list firstvar is actually NOT a list (I checked its length, and it gives me 1, instead of 6). If I assign := the value of firstvar to another variable, then everything works, but the programs behaves really weirdly. Possibly, there is an easy and straightforward way to solve this issue, but I do not know it. Any help will be highly appreciated. Thanks doingsomething[m_, p_, _] := Abs[m - Total[RotateLeft[ReplacePart[Array[0 &, Dimensions[m]], p -> 1], #] & / @ {{0,0}}]] Manipulate[ Grid[{{firstvar = Dynamic[Flatten[inputstring]]}, {SeedRandom[seed]; DynamicModule[{m = RandomInteger[{0, 1}, {1, q}], gg = {0, 0}}, Dynamic@(If[gg == {0, 0}, {}, m = doingsomething[m, gg, q]; gg = {0, 0}; inputstring = m;]; Pane[TableForm[ MapIndexed[ Button[" ", gg = #2, ImageSize -> {250/(q + 1), 250/(q + 1)}, Background -> {White, Black}[[1 + #1]]] &, m, {2}]], {450, 200}, Alignment -> Center])]}, {ArrayPlot[ CellularAutomaton[0, firstvar, 10]]}}], {{q, 6, "size"}, 3, 9, 1}, {{seed, 1, "new game"}, 1, 1000, 1}, SaveDefinitions -> True]
|
Pages: 1 Prev: partial derivate of a function of vector variable Next: Fourier transform of exponential function |