Bug 341256 - wrong graph plotted for integral
Summary: wrong graph plotted for integral
Status: RESOLVED FIXED
Alias: None
Product: kmplot
Classification: Applications
Component: general (show other bugs)
Version: 1.2.1
Platform: Ubuntu Linux
: NOR major
Target Milestone: ---
Assignee: Christoph Feck
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-25 16:06 UTC by amaramardhruva
Modified: 2020-01-15 18:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description amaramardhruva 2014-11-25 16:06:40 UTC
I plotted graph for e^x^2
then i used show integral.
when i move the graph changes.

Reproducible: Always

Steps to Reproduce:
1.Create new function(Cartesian plot)
2.Enter f(x)=e^x^2
3.Go to integral tab and press show integral
4.Move the graph around

Actual Results:  
When the graph is moved left it shows correct graph.
when it is moved right wrong graph

Expected Results:  
Shown a consistent graph of integral e^x^2

I don't know what other functions cause this error
check the graph http://www.wolframalpha.com/input/?i=integrate+e^x^2&dataset=&equal=Submit
90% other graphing software give error
screen shot http://postimg.org/image/hroeu4yyh/
Comment 1 amaramardhruva 2014-11-25 16:15:44 UTC
This is better graph http://www.wolframalpha.com/share/clip?f=d41d8cd98f00b204e9800998ecf8427eluqe9l1lm2
Comment 2 Yuri Chornoivan 2018-10-20 12:26:22 UTC
Just a side mark: KmPlot with the default step correctly calculates integral at least when the minimum value for x is -3 (and for sure, for x in [-1, 1] as on the Mathematica plot). It fails for a wider range because of the cumulative finite difference calculation error.

It is hard to determine a condition to stop calculations if f(x) becomes too big for integral calculations.
Comment 3 Yuri Chornoivan 2020-01-15 18:59:32 UTC
Git commit 2b63a01634fc1653ead0ec9caeae4ed89fc95165 by Yuri Chornoivan.
Committed on 15/01/2020 at 18:59.
Pushed by yurchor into branch 'master'.

Keep cumulated error negligible for rapidly increasing functions

Summary:
The current scheme violates Runge-Kutta condition on error O(h^4) when dy is too high. This leads to visible shifting and discontinuities on the plots of integrals for e^x^2, e^abs(x), etc.

Test Plan:
1. Compile and install KmPlot.
2. Create the Cartesian plot "f(x) = e^x^2".
3. Switch to the "Integral" tab and tick the "Show integral" item.
4. Try to change the scale (Ctrl+mouse wheel). The integral curve should be plotted as expected (no discontinuities, no extra lines on Ox).

f(x)=e^x^2 and its integral

Before the patch:
{F7764991}
After the patch:
{F7764992}

Reviewers: #kde_edu

Subscribers: aacid, cfeck, kde-edu

Tags: #kde_edu

Differential Revision: https://phabricator.kde.org/D24972

M  +3    -2    kmplot/xparser.cpp

https://commits.kde.org/kmplot/2b63a01634fc1653ead0ec9caeae4ed89fc95165