graph.tk icon indicating copy to clipboard operation
graph.tk copied to clipboard

How to avoid vertical lines for undefined x-values?

Open echteinfachtv opened this issue 12 years ago • 2 comments

If you plot a graph, say (x+3)/(x-2) you have an undefined value at -2. This should not be drawn, however, we get a vertical line: http://www.gute-mathe-fragen.de/?qa=blob&qa_blobid=18172464407364120737

Another example, even worse: x+tan(x) http://www.gute-mathe-fragen.de/?qa=blob&qa_blobid=8602167692544029133

This an important issue as users might think there is some value defined.

How can we solve that?

PS: I am ready to donate some money if that could be solved. As I said, that is a very important issue.

echteinfachtv avatar Nov 30 '12 09:11 echteinfachtv

I think the best way to solve this problem would be by avoiding parts of the domain where it becomes infinite. I think this would be equivalent to skipping the regions where 1/f(x) has a zero factor.

The other option is interval arithmetic, which could become very complicated, since this essentially means I will need to invent a new number type instead of simply dealing with the JavaScript Number type, or an OpenGL float type. This option would work, but might be difficult.

A third option would be to just skip the line segment if it jumps too quickly. I would do this by just making the line segment transparent between any two points which have a large jump.

And I don't need a donation at the moment, thanks.

aantthony avatar Dec 08 '12 03:12 aantthony

Maybe we should skip values in general that are higher than y=1000 and lower than y=-1000.

I remember writing a tangent program where I checked for the "jump" from tan(x), e. g. tan(x1) = 1000, tan(x2) = -1000, and did not draw that line.

I would be very glad if you implement this in the recent graph.tk → and if you do, how can I donate some beers to you?

Thanks, Kai

echteinfachtv avatar Dec 08 '12 12:12 echteinfachtv