Render...Function Plotter analytical derivatives incorrect

Bug #230765 reported by Sean McGivern
4
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Unassigned
Nominated for 0.46.x by Rygle

Bug Description

In the Function Plotter, entering an analytical derivative in "First derivative" and unchecking "Calculate first derivative numerically" leads to an incorrect function in 0.46. This can be seen by entering x**2 as the function and 2*x as the first derivative with x-range -5.0 to 5.0 and y-range -0.1 to 30, any number of samples (at least up to 32). With "Calculate first derivative numerically" checked, beautiful parabola; without it, not a beautiful parabola. I also confirmed this with exp(-x*x) as the function and -2*x*exp(-x*x) as the derivative.

sas (sas-sas)
Changed in inkscape:
status: New → Confirmed
Revision history for this message
Alvin Penner (apenner) wrote :

attached is a modified version of the file C:\Program Files\Inkscape\share\extensions\funcplot.py, which I believe should fix this problem. I modified the usage of the analytical first derivative.

hth...

Revision history for this message
sas (sas-sas) wrote :

The problem is just that there are a couple of zeros that should be ones. I've attached a patch.

(This patch is essentially equivalent to Alvin Penner's, because

        dx0 = (x1 - x0)/ds # Only works for rectangular coordinates
        dy0 = fp(xstart)*dx0

in his version can be simplified to

        dx0 = 1 # Only works for rectangular coordinates
        dy0 = fp(xstart)

as (x1 - x0)/ds == 1, and similarly for dx1 and dy1.)

Revision history for this message
Alvin Penner (apenner) wrote :

sounds good to me ...

Revision history for this message
Rygle (rygle) wrote :

I am unable to test this on either 0.46 Win32 or 0.46+dev Win32 (built from SVN two days ago), as neither of them are giving any visible results. Didn't patch and rebuild, but manually edited the .py file in the existing build.

Sas, is there any possibility that this could be related the the problem you picked up in the Polyhedron 3D extension? I'm doubtful, as that one worked on 0.46 and not on the dev version, while this doesn't seem to be working on either for me.

Revision history for this message
Rygle (rygle) wrote :

Using Inkcl.bat to catch the stderr output, I get the following;

====
** (inkscape.exe:3580): CRITICAL **: void Inkscape::GC::Anchored::release() cons
t: assertion `_anchor' failed
====

Can't get anything from gdb, as when I run it and try doing running function plotter, it keeps displaying the message 'Function Plotter' working, please wait..., and starts hogging system resources (99% processor). Have to quit the DOS window (and hence gdb and Inkscape) to get control back.

Revision history for this message
Rygle (rygle) wrote :

Actually, forget that. The same message comes up even when I don't run Function Plotter.

Revision history for this message
Alvin Penner (apenner) wrote :

not sure if you've run this before or not, but when you use Function Plotter it is essential to first draw a rectangle and the rectangle must be selected, otherwise there is no output

Revision history for this message
Rygle (rygle) wrote :

OK Thanks Alvin. Did that and it works well.

I've patched this in SVN at revision 18663

Revision history for this message
Rygle (rygle) wrote :

Since this is also a problem with an existing function, I'll nominate this for 0.46.1

Changed in inkscape:
importance: Undecided → Low
milestone: none → 0.46.1
status: Confirmed → Fix Committed
Alvin Penner (apenner)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.