Gnuplot miscalculates formula badly

View: New views
3 Messages — Rating Filter:   Alert me  

Gnuplot miscalculates formula badly

by ariadland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I plotted the following function in gnuplot (version 4.2   patch 5)

plot [.5:1.5] 1/(1/2.9898+94*(-x**2+1)**2*(-x**2+4/3)**2)  

The resulting figure should have two peaks.  One at x=1,  and one at about x=1.2.  Gnuplot, however, just shows one smooth peak.

When I type in

plot [.5:1.5] 1/(1/2.9898+94*(-1.2**2+1)**2*(-1.2**2+4/3)**2)  

gnuplot returns a value that is horribly wrong  (checked by mathematica and matlab).

Does it have something to do with the division?  I'm not sure,  but this is a serious flaw.

Re: [Gnuplot-bugs] Gnuplot miscalculates formula badly

by Hans-Bernhard Bröker-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ariadland wrote:
> I plotted the following function in gnuplot (version 4.2   patch 5)
>
> plot [.5:1.5] 1/(1/2.9898+94*(-x**2+1)**2*(-x**2+4/3)**2)  
>
> The resulting figure should have two peaks.  One at x=1,  and one at about
> x=1.2.

What you want and what you told gnuplot to do doesn't match.  The
problem, like just about every time this issue comes up, is that you
missed paragraph 3 of "help expressions"

The function you want is

plot [.5:1.5] 1/(1/2.9898+94*(-x**2+1)**2*(-x**2+4.0/3)**2)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gnuplot-bugs mailing list
gnuplot-bugs@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-bugs

Re: [Gnuplot-bugs] Gnuplot miscalculates formula badly

by ariadland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks.

I can't believe I missed that.  I am usually great with number types in fortran.

Now I feel like an idiot.