Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline dg1727  
#1 Posted : 27 May 2010 16:23:25(UTC)
dg1727


Rank: Member

Groups: Registered
Joined: 11/05/2010(UTC)
Posts: 15
Man

Hello,

Following are some suggestions, as of SMath Studio version 0.88, to make it easier for users to develop "for" and "while" loops.

I suppose these suggestions are of low priority - probably most users of SMath Studio do not develop their own iterative programming.

1. If processing is interrupted by the user, somehow change the formatting of the items that haven't been calculated yet. This is to keep the user from seeing results from a previous run of the algorithm (with different input values) and thinking the results are from the interrupted run. If Mathcad changes the formatting as suggested, imitating Mathcad should be fine. Or the results of "evaluate numerically" (=) and "evaluate symbolically" ( -> ) statements could be changed to placeholders, with a tooltip showing something like "Calculation interrupted by user.", and graphs should have all plotted points removed, with the same tooltip. Also show "(interrupted)" in the status bar, after the elapsed time.

To test: Find a worksheet with a time-consuming calculation which generates at least one number and a graph. Result number(s) should be shown by at least one "evaluate numerically" and at least one "evaluate symbolically" operators. Allow the worksheet to calculate once, then change an input value that results in the calculation being re-run and the graph re-drawn (Calculation > "Auto calculation" turned on). During this 2nd run, press ESC to interrupt the calculation. Verify that results below the interrupted statement are re-formatted as described in this suggestion.

2. Somehow indicate variables that are not used in any calculation. This is to help the user find those variables so he or she can remove them (or remember to add a calculation that depends on a particular variable). There could be a Tools > Options... setting such as "Show number of direct dependents in tooltip" to add text like "Direct dependents: 2" to the end of tooltips that are drawn over variables. (By "dependent" I mean a calculation that depends on the variable.)

3. a. If a loop completes partway and then stops, so that a tooltip with string 663 is shown ('Cannot get or set an element, because it doesn't exists.'Wink, it may save the user some time if the tooltip also shows the coordinates of the element that was attempted to be accessed and then the dimensions of the matrix. For example:
Code:
Requested matrix element doesn't exist:  (6;1)
Matrix dimensions:  (5;1)
Of course, the arguments separator (; in my example) should be localized.

Test case:
input←range(1;5)
y←0
for(x;range(1;7);line(if(el(input;x)≡0;y←y+1;1);1;1))

b. It would be great if the statement in question (el(input;x)) in this test case) could have a rectangle drawn around it, or otherwise be graphically emphasized, only while the tooltip is visible. A loop with several nested "if", "for", or "while" functions could refer to the matrix in question in multiple places; but presently, the tooltip applies to the whole (outermost enclosing) "if", "for", or "while", so it might not be obvious where the error is being detected.

4. a. A "watch" window which shows the values of variables as the worksheet is calculated. The user can select which variables are displayed. The display can be updated at a constant interval, say, about every 15 ms, NOT necessarily on each loop iteration, so that an algorithm with a very large number of very fast iterations is not greatly slowed down by the "watch" window. The "watch" window is meant to be used only during debugging, and would not have its settings saved with the worksheet file.

b. A special case is the following. Have 2 special variables (for example, SMathProgressPct and SMathProgress) which, if given value(s) by the user, are shown in the status bar. SMathProgressPct is meant to range from 0.0 to 1.0 and shows a progress bar, plus the number formatted as a percentage ("0.0%" to "100%", plus maybe "< 0" and "> 100%" - maybe the absolute value should be taken in case the user gives this variable a complex value). SMathProgress can be given any value and is shown literally (meant for algorithms whose number of iterations, or some other measure of progress, is not known beforehand). Either or both of the special variables can be used; only the one(s) which are used are displayed. The status bar might look like:

Code:
Calculation:  3.500 sec.  XXXXX----- 50.0%  833.0


It might be appropriate for these special variables to disappear from the status bar once the largest enclosing "for" or "while" is completed. So a worksheet with 2 time-consuming loops would, if the special variables are defined by the user as expected, have the progress bar go from 0% to 100% and then a 2nd time from 0% to 100%.

This progress display, being driven by (reserved) worksheet variables, does have its operation saved as part of the worksheet file; this progress display is meant to benefit someone who opens an unfamiliar worksheet for the first time.

5. a. A way to run one loop iteration at a time. After each iteration, tooltips or other means can be used to show variable values; and the user has an option to (1) run one more iteration and stop again, or (2) continue the loop at full speed.

b. The same but, instead of just one iteration, the loop runs until a user-specified expression is true. As with "watch" windows, the settings for this are not saved with the worksheet.

6. A function similar to Mathcad's time() (mentioned in http://twt.mpei.ac.ru/ochkov/Lace/Lace_eng.htm) could be added. If 2 time-consuming loops are on the same worksheet, then the time() function can be used to show the time taken by each loop individually. Presently, the status bar shows only the total calculation time for the worksheet.

Edited by user 27 May 2010 16:43:48(UTC)  | Reason: Not specified

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.