Hello, there is a difficulty with constructing graphs of functions that have irrational points of discontinuity (of type tg(x) in Pi/2 ). If the break point is an integer, then there are no problems: as a result of the cycle, an exception is thrown and I just don’t enter the pair (X;Y) in the dictionary, but it’s harder with irrational numbers, because it’s impossible to get into them. How to be in this case? Thank you in advance.

  • This is not exactly annoying: let us have a step = 0.01, then the tangent values ​​at the points 1.56, 1.57, 1.58 = 92.62, 1255, -108.64. If you connect these points, the graph will turn out, to put it mildly, ugly, the whole graph will merge into a sequence of vertical lines. - nvse
  • NDA .. somehow I didn’t think that you can and don’t get into the “hole”. An interesting question, I will try to pick it up and write something else out of liberty. - SilverIce
  • Apparently an absolutely illiterate method, but the first thing that comes to mind. If between the points i and i + 1 the function changes sign, then we check its behavior between the points i-1, i and i + 1, i + 2. If it was growing (decreasing) both on i-1, i, and on i + 1, i + 2, then there is no need to draw a line between i and i + 1 (break point). - avp
  • Apparently he did not quite understand, but here is a simple example: sin (x) on the interval [3.13; 3.16] in increments of 0.01. When going through 3.14 to 3.15, the sign changes. As in the [3.13; 3.14] segment and [3.15; 3.16], the sine monotonically decreases, but this does not mean the existence of discontinuity points in my opinion - nvse
  • Yes, you are right that you wrote will not work. It is also necessary to keep track of the fact that i + 1, i + 2 became less (if it grew) than i-1, i. Similarly, for decreasing - it became more. - avp

2 answers 2

Usually build as. Consider the point, remember. Consider the following - and connect straight.

Holes are usually made by the exception handling method DELETING the memorized point (are you annoyed by the vertical line (reverse), in the tangent graph?)

Matkadas and others work with a semi-analytic search for the domain of definition. It is extremely difficult.

    The correct result can be obtained as follows: your current program runs on the value grid with a certain step . Accordingly, a beautiful picture can be obtained either by increasing the grid resolution, or by interpolating neighboring values, for example, using сплайнов.


    In the case of your break point when calculating tan(pi / 2) , it is enough to take the neighboring points on the grid and interpolate between them. As far as I know, graph builders like Microsoft Math just that.