I move pc and qc into Dynamic, as you advise, it works well.
But there is another related problem, I will try to explain with the code:
DynamicModule[{pc, n = 3, qc, m = 3, g, ct = 5},
Column[{
Row[{
Column[{
Slider[Dynamic[n], {1, 8, 1}, Appearance -> "Labeled"],
Slider[Dynamic[m], {1, 8, 1}, Appearance -> "Labeled"]
}],
RadioButtonBar[
Dynamic[ct], {5 -> Z],
1 -> Q]}]}
],
Dynamic[
pc = Function[g, Rationalize[g, ct*0.1]] /@
RandomReal[{-10, 10}, n + 1]],
Dynamic[
qc = Function[g, Rationalize[g, ct*0.1]] /@
RandomReal[{-10, 10}, m + 1]],
Dynamic[Grid[{pc, qc}, Frame -> All]]
}
]
]
If I run the above code, I get:
As expected, but I want to show, as a final result, only the grid.
To hide the lists pc and qc I replace commas by semicolons where pc and qc are defined:
Dynamic[pc =
Function[g, Rationalize[g, ct*0.1]] /@ RandomReal[{-10, 10}, n + 1]];
Dynamic[qc =
Function[g, Rationalize[g, ct*0.1]] /@ RandomReal[{-10, 10}, m + 1]];
Dynamic[Grid[{pc, qc}, Frame -> All]]
But now the result is:
I have previously programmed with functional languages like Haskell but this one has me confused.
Your help is and will be appreciated.