Deprecated: Required parameter $errors follows optional parameter $type in /customers/5/9/f/padowan.dk/httpd.www/forum/include/parser.php on line 524

Topic: Strange Bug in Graph

I'm using Graph 4.4 Beta 508. I've encountered a strange bug while trying to write a plugin, and I think I've been able to isolate it. The file attached is an example showing this bug.

To reproduce the bug:

Open the file. Right-click on the first function and choose Insert f'(x) and click Ok. The derivative is inserted. Double click on the new derivative function and then click Ok without changing anything. Suddenly the function has changed to a different function!

Notes: The function DISPLAYED initially is the correct one, but the formula does not match the function displayed. Once you click on it and click Ok, the function displayed changes to match the formula shown, which is incorrect. Saving the file, closing and re-opening has the same effect as double clicking the function and choosing Ok. If you double click the function and choose Cancel, the original correct function remains displayed, but the formula is still incorrect. The other function included in the file is a simpler formula for exactly the same function; however, this function can be differentiated normally and correctly.

Please let me know if anyone can reproduce this bug, or if it's just me. Thanks!

-James

Post's attachments

Attachment icon Graph Bug.grf 708 b, 719 downloads since 2011-09-14 

Re: Strange Bug in Graph

Thanks for notifying me about this problem. You are of course right. There is a bug in the generation of the text. Graph tries to remove redundant operators and parentheses, so you don't see things like 2+-x. Unfortunately it removed a plus here that changed the function. I have now fixed it in the beta version.

Re: Strange Bug in Graph

Great, thanks very much Ivan! I suspect this will solve a couple of minor issues I've seen with a few functions, but I'll experiment a bit with the new version, and let you know if I find any problems that remain.

Re: Strange Bug in Graph

Ivan,

I think I've found another version of this bug that remains in the most recent version of Graph.

Open the attached file, right-click the function and differentiate it. The correct function will display.

Next, double click the function, and then just choose OK. The function changes to the wrong one.

It seems very similar to the bug you fixed before.

Thanks again,

-James

Post's attachments

Attachment icon Bug.grf 598 b, 694 downloads since 2012-05-09 

Re: Strange Bug in Graph

Yes, this bug is similar. This time Graph removed a set of brackets, which changed the function. Thanks for notifying me. I have now fixed it in the beta version.

Re: Strange Bug in Graph

I found one more bug of a similar type, still in the current beta.

Check out the attached file. Differentiate the function, and it leaves two negative signs at the beginning. This doesn't actually affect the function at all in this case, but I'm not sure if there are other functions that might be broken by this.

-James

Post's attachments

Attachment icon Bug 2.grf 567 b, 697 downloads since 2012-05-10 

Re: Strange Bug in Graph

...and curiously, if you change the coefficient "2" to a "1" in the attached file, the bug disappears.

Re: Strange Bug in Graph

This is not really a bug. You can find a lot of cases where the resulting function can be simplified. I plan to improve this in the next version.