Message Boards Message Boards


Get a steady PlotLabel for a running simulation graphics?

Posted 1 year ago
2 Replies
2 Total Likes

Please, activate the simple simulation (of a harmonic oscillator) by activating the run box. Together with the red moving 'particle' there is shown a Row of text and numbers. Whenever one of the numbers should have 0 as the last digit, this digit is not printed and all output down the Row gets shifted. This is inconvenient if --- in our case --- one tries to see how the energy conservation error (e-e0)/e0 varies upon a change in the time step. Is there a practicable way to avoid the mentioned inconvenience?

2 Replies

This seems to ameliorate the problem:

Row@{"count = ",
  PaddedForm[count, 8,
   NumberPadding -> {" ", "0"}], Spacer[20],
  "t = ",
  NumberForm[N[t], {10, 4},
   NumberPadding -> {" ", "0"}], Spacer[20],
  "(e-e0)/e0 = ",
  NumberForm[(e - e0)/e0, {8, 4},
   NumberPadding -> {"0", "0"}, 
   ExponentFunction -> (3 Quotient[#1, 3] & )]}

Thanks a lot Gianluca. The option NumberPadding -> {" ", "0"} is what I missed. Appended is the minimal version which is OK for me.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract