There are two options:
- user error
- software error
The first one is much more likely.
Thoroughly inspect your equations and you will find that they are _not_
equivalent.
Hint: look at f6(x)
Tammo
> -----Original Message-----
> From: gnu...@li...
> [mailto:gnu...@li...] On Behalf
> Of Marek W. Gutowski
> Sent: Friday, February 15, 2008 10:35 AM
> To: gnu...@li...
> Subject: [Gnuplot-info] complicated function expressions
>
> I'm trying to plot two identical functions, f(x) and g(x).
> f(x) is defined as a single, looong expression, while g(x) is
> defined as a composition of several simpler functions. Yet,
> as you can see in the picture attached - f(x) and g(x) look
> differently. g(x), made of smaller chunks of code, is correct.
> Why are they different?
> Is there any limit for the length of the expression defining
> a function??
>
> Intrigued,
> Marek Gutowski
>
> gnuplot> show funct
>
> User-Defined Functions:
>
> f(x)=(pi*(1.0-0.5/(x**2))+2.0*atan(2.0*x)/(x**2)-2.0*(1.0+0.25
> /(x**2))*atan(4.0*x)-10.0*atan(0.25/x)+4.0*(1.0+0.25/(x**2))*a
> tan(0.5/x)+2.0*log((1.0+4.0*x**2)/(1.0+16.0*x**2)))/(-2.0*pi)
> f1(x)=pi*(1.0-0.5/(x**2))
> f2(x)=2.0*atan(2.0*x)/(x**2)
> f3(x)=-2.0*(1.0+0.25/(x**2))*atan(4.0*x)
> f4(x)=-10.0*atan(0.25/x)
> f5(x)=4.0*(1.0+0.25/(x**2))*atan(1.0/(2.0*x))
> f6(x)=2.0*log((1.0+4.0*x**2)/(1.0+16.0*x**2))/x
> g(x)=-(f1(x)+f2(x)+f3(x)+f4(x)+f5(x)+f6(x))/(2.0*pi)
>
> gnuplot> plot [0.0001:10.0] g(x) w l 3, f(x) w l 6
>
> I am working with
> G N U P L O T
> Version 4.0 patchlevel 0
> last modified Thu Apr 15 14:44:22 CEST 2004
> System: Linux 2.6.18-6-k7
>
> Yes, I know there is a newer version but my Debian Linux is
> rather conservative and I stick strictly to the stable
> distribution. The processor is Athlon XP2000+
> --
> Marek W. Gutowski
> Institute of Physics, ON-3.2, Al. Lotnikow 32/46
> 02-668 Warszawa, POLAND, tel. +48-22-0228436601 ext. 3122 >>
> To talk or not to talk? Yes, talk, plain ASCII please <<
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
This e-mail (including any attachments) is confidential and may be legally privileged. If you are not an intended recipient or an authorized representative of an intended recipient, you are prohibited from using, copying or distributing the information in this e-mail or its attachments. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete all copies of this message and any attachments.
Thank you.
|