I would like to see how the graph of the function en[B, i, j, k, p] changes depending on i, j, k, p in real time. In my case, the graph is not shown inside the loop at all.
How could it be done?
ClearAll["Global`*"]
en[B_, i_, j_, k_, p_] := B2(i + j/k) + Exp[-p*i]
For[i = 1, i < 5, i++,
For[j = 1, j < 4, j++,
For[k = 1, k < 3, k++,
For[p = 1, p < 2, p++,
TE[i_, j_, k_, p_] := Table[{B, en[B, i, j, k, p]}, {B, 0, 6, 1}];
Pause[0.2];
ListPlot[
Table[{TE[i, j, k, p][[l, 1]], TE[i, j, k, p][[l, 2]]}, {l, 1,
7}], PlotRange -> All]]]]]
Manipulate? From the documentation forFor"Unless an explicit Return is used, the value returned by For is Null." TryPrint@ListPlot[...]. – Rohit Namjoshi Jun 10 '23 at 20:12Print@ListPlot[...], all graphs are displayed on the screen. I would like the graphs to change each other, i.e. the second graph changed the first graph on the screen, after which the third graph replaced the second one, and so on. I would like to have one card on the screen, the content of which changes depending on the changes in thei,j,k,p. – Mam Mam Jun 10 '23 at 20:37plots= {0}and thenDynamic[plots][[-1]]before the loop. When you then run theForloop with theAppendToin Rohit's answer, the line withDynamicshould update and show you the latest plot. Can you try it? I'm away from my Mathematica machine for a few days. – Marius Ladegård Meyer Jun 11 '23 at 19:54