Luaplot/plotfunc And Sign Function
Started by
Alvise
, Oct 23 2005 10:53 AM
1 reply to this topic
#1
Posted 23 October 2005 - 10:53 AM
Hi.
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 ?
Thanks.
#2
Posted 23 October 2005 - 01:31 PM
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"..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 ?
Edit: Fixed; LuaNumAn version 1.50 includes a way to handle discontinuities in PlotFunc.
Edited by PAP, 13 March 2006 - 11:23 AM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users