Smoothing nice areas

If I have a function such as sin(1/x), I want to build and show close to 0, how would I smooth out the results in the plot? By default, the number of sample points is relatively small for what I'm trying to show.

Here is the code:

from sympy import symbols, plot, sin

x = symbols('x')
y = sin(1/x)

plot(y, (x, 0, 0.5))

enter image description here

As it xapproaches 0, the line becomes more jagged and less sinuous. Is there any way to fix this?

+4
source share
1 answer

You can set the number of points used manually:

plot(y, (x, 0.001, 0.5), adaptive=False, nb_of_points=300000)

enter image description here

. ZeroDivisionError - ( , x 0 -), (). , , adaptive=False, nb_of_points=300000, xmin (0.001).

+8

Source: https://habr.com/ru/post/1628755/


All Articles