DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Function parser error

 
Post new topic   Reply to topic    DPlot Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
akselfr



Joined: 10 Dec 2003
Posts: 15

PostPosted: Mon Mar 07, 2005 8:05 am    Post subject: Function parser error Reply with quote

I'm plotting some functions using the 'Generate -> Y=f(X)' option.
For some odd reason the following expression returns identically
zero for x in [0;3], dX=0.01

f(x) = 5.*(cosh(4.*x)+4.*cosh(2.*x)+3.)

If I build up the expression term by term, everything works fine,
until I enclose in parentheses. Then the result is exactly 0.

Any clues ?
I'm running version 1.9.8.5
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Mon Mar 07, 2005 9:38 am    Post subject: Reply with quote

Aksel,
Thanks for pointing out the problem. The function parser doesn't like trailing decimal points in numbers. DPlot preprocesses the function before passing it to the parser and, among other things, eliminates trailing decimal points (all numbers are treated as doubles, so nothing is lost here). But I've somehow fouled up in this case and missed the last "3.", which throws off the parser. That's much more information than you need to know, just wanted to let you know what's going on here. If you instead use:

f(x) = 5*(cosh(4*x)+4*cosh(2*x)+3)

or

f(x) = 5.0*(cosh(4.0*x)+4.0*cosh(2.0*x)+3.0)

then you'll get the expected result. This will definitely be fixed in the next release; sorry for the inconvenience.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> Bug Reports All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group