View previous topic :: View next topic |
Author |
Message |
akselfr
Joined: 10 Dec 2003 Posts: 15
|
Posted: Mon Mar 07, 2005 8:05 am Post subject: Function parser error |
|
|
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 |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2311 Location: Vicksburg, Mississippi
|
Posted: Mon Mar 07, 2005 9:38 am Post subject: |
|
|
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 |
|
|
|
|
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
|