mkulesh / microMathematics

microMathematics Plus - Extended visual calculator
GNU General Public License v3.0
566 stars 68 forks source link

some functions are plotted incorrectly #46

Closed plottar closed 6 years ago

plottar commented 6 years ago

Some functions are plotted incorrectly (at least when using the standard setup for N, x1, x2 and x as defined in the Example for Function Plot).

To reproduce: Just edit f(x) and the first coordinate system in the example for Function Plot:

f(x) := 1/x Edit the lower boundary of the y-axis to -40. Calculate worksheet.

mkulesh commented 6 years ago

Hi @plottar, sorry for a late response. In this example, you have a division to zero that provides an infinity value at x = 0. As a result, the function increases too fast that can not be seen with given x-resolution 300 points between -30 and 30. I just improved the x-resolution (see attached example) and the function is plotted correctly. device-2018-01-07-222135

Are you agree with this explanation?

plottar commented 6 years ago

Hi Mikhail;

it took its time but I am glad you provided a response at all :-)

Unfortunately, still, the graph is plotted incorrectly. The parts of the graph in the first and third quadrant of the coordinate system should be disjunct, like in this example:

https://upload.wikimedia.org/wikipedia/commons/4/43/Hyperbola_one_over_x.svg

Best regards; plottar

mkulesh commented 6 years ago

thanks for the explanation, now I see the problem. I will try to fix it.

mkulesh commented 6 years ago

Hi @plottar, I hope, the problem is fixed now. Please download the latest autobuild if you want to test it: https://github.com/mkulesh/microMathematics/raw/autobuild/autobuild/microMathematics-v2.16.apk Attached, please see an example that I used for developer test: device-2018-01-14-223503 Please also note that x-resolution still be an important factor. If the nearest to zero x-value provides any y-value that is inside of the visible plot area, it is numerically impossible to produce a gap before the next point. You can observe this effect if you decrease N in the attached example to 47 instead of 100. An extreme example: device-2018-01-14-224608

If my solution works as expected, please close the issue.

plottar commented 6 years ago

Thanks, works like a charm.

mkulesh commented 6 years ago

Thank you for reporting and testing this issue. Fixed in v2.16.1