In the lua program i have defined sign function as |x|/x and i've ploted it. In the second image is possible to see the plot, and is possible to see that around "0" the plot is ... "so strange". The function goes vertically.. anyone know why ?
Obviously, your "sign" function is undefined at x=0. Change it by the
math.sign function, already included in CPLua. Note that, even then, you will see an almost vertical line connecting (0,-1), (0,0), and (0,1). This is because of the definition of the
math.sign function (for x=0, it's equal to 0, as in every programming language that supports a similar function). Note that
PlotFunc is not designed to plot non-continuous functions; this behavior may change in the future, but I think that it's rather not important, and has a low priority in my list to "to do" things"..
Edit: Fixed; LuaNumAn version 1.50 includes a way to handle discontinuities in PlotFunc.
Edited by PAP, 13 March 2006 - 11:23 AM.