From: SourceForge.net <no...@so...> - 2010-10-31 19:47:36
|
Bugs item #3100138, was opened at 2010-10-31 19:52 Message generated for change (Settings changed) made by crategus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3100138&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Lisp Core - Plotting Group: None >Status: Closed >Resolution: Works For Me Priority: 5 Private: No Submitted By: MSP1 (msp1) Assigned to: Nobody/Anonymous (nobody) Summary: Inconsistent evaluation in plot2d Initial Comment: I was trying to produce "staircase" plots of computed and experimental data held in a list when I found the problem illustrated in simplified form by the following lines. (%i1) askinteger(round(x)); /* No problem here */ (%o1) yes (%i2) define_variable(data, [1.2, 4.6, 7.2, 5.6, 2.3], float); (%o2) [1.2, 4.6, 7.2, 5.6, 2.3] (%i3) data[round(2.6)]; /* Nor here */ (%o3) 7.2 (%i4) plot2d(data[round(i)], [i, 1, 5]); /* but oops! */ apply: subscript must be an integer; found: round(i) ---------------------------------------------------------------------- >Comment By: Dieter Kaiser (crategus) Date: 2010-10-31 20:47 Message: The documentation of plot3d has an example which shows the way to get a plot for an integer function. The trick is to use the quote operator when passing the function as an argument to the plot command: plot2d('data[round(i)], [i, 1, 5]); Closing this bug report as "works for me". Dieter Kaiser ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3100138&group_id=4933 |