Package: gnuplot
Version: 4.2.2-1.2
Severity: minor

It need more then 1G of ram in order to trace a mathieu function plot. 

mathieu4.out is generated by the c program compile with c99.

out file is about 12M. mathieuplot4p1.dat is about 35M do not know why it is so 
memory hungry.

Thanks


-- 

"ROUCARIÈS Bastien"
                                            roucaries.bastien+deb...@gmail.com
-------------------------------------------------------------------------------
DO NOT WRITE TO roucaries.bastien+blackh...@gmail.com OR BE BLACKLISTED
#include<stdio.h>
#include<math.h>
#include<complex.h>

int
main ()
{
  FILE *fp;			// Prepare to print to file
  fp = fopen ("mathieu4.out", "w");
  int m, i, j;
  double complex e[201], d[101], alpha, beta, alpha1, mu;
  double q, a, ah;
  double pi = 3.141592653589;
  a = 0;
  q = 0;

  for (q = 0; q <= 1;)
    {	
      if(q <= 1e-6)
	q += 1e-7;
      else if (q <=  1e-5)
	q += 1e-6;
      else if (q <= 1e-4)
	q+= 1e-5;
      else if (q <1e-3)
	q+= 1e-4;
      else if (q<1e-2)
	q+= 1e-3;
      else
	q+=1e-2;
      


      //Loop over the desired
      printf ("%f\n", q);
      for (ah = 0; ah < 1;)
	{
	  if(ah < 0.15 || ah > 0.85)
	    ah = ah + 0.005;
	  else
	    {
	      //a-q region
	      if (fabs (2 * ah - round (2 * ah)) < 0.1)
		{
		  if (fabs (2 * ah - round (2 * ah)) < 0.01)
		    if (fabs (2 * ah - round (2 * ah)) < 0.001)
		      ah = ah + 0.000001;
		    else
		      ah = ah + 0.00001;
		  else
		    ah = ah + 0.0001;
		}
	      else
		ah = ah + 0.005;
	    }

	  a = 4 * ah * ah;


	  //printf("%f ",a);
	  for (m = 0; m <= 248; m += 2)
	    {
	      e[m] = q / ((m * m * 1.0) - a);
	    }			//Set all components

	  //The first seed determinants, from Maple worksheet
	  d[3] =
	    -2 * e[2] * e[2] * e[0] * e[4] * e[4] * e[6] +
	    e[2] * e[2] * e[4] * e[4] -
	    2 * e[4] * e[4] * e[2] * e[0] * e[6] * e[6] +
	    2 * e[2] * e[4] * e[4] * e[6] + e[4] * e[4] * e[6] * e[6] +
	    2 * e[2] * e[2] * e[0] * e[4] + 4 * e[2] * e[0] * e[6] * e[4] -
	    2 * e[2] * e[4] - 2 * e[6] * e[4] - 2 * e[2] * e[0] + 1;

	  d[2] =
	    1 - 2 * e[2] * e[4] - 2 * e[2] * e[0] +
	    2 * e[2] * e[2] * e[0] * e[4] + e[2] * e[2] * e[4] * e[4];

	  d[1] = 1 - 2 * e[2] * e[0];

	  d[0] = 1;

	  for (m = 4; m <= 100; m++)
	    {			//Here goes Strang's interation method
	      alpha = e[2 * m] * e[2 * (m - 1)];
	      beta = 1 - alpha;
	      alpha1 = e[2 * (m - 1)] * e[2 * (m - 2)];
	      d[m] =
		beta * d[m - 1] - alpha * beta * d[m - 2] +
		alpha * alpha1 * alpha1 * d[m - 3];
	    }

	  //Find mu, make seperate case for -a situation
	  if (a >= 0)
	    {
	      mu = cacos (1 - (d[100]) * (1 - cos (pi * sqrt (a)))) / (pi);
	    }
	  if (a < 0)
	    {
	      mu =
		cacos (1 -
		       (d[100]) * (1 - cosh (pi * sqrt (fabs (a))))) / (pi);
	    }
	  if (mu != mu)
	    {
	      mu = 0.000000;
	    }			//If mu=nan then make it zero

	  fprintf (fp, "%f %f  %f \n", q, ah, cimag (mu));
	}
      fprintf (fp, "\n");
    }
}
#set data style lines
#set contour base
#set cntrparam levels discrete 0.001
#set nosurface
#set view 0,0
#splot 'mathieu.out'

# For the inner contours:
set xlabel 'q'
set ylabel 'p'
set yrange [0:1]
set xrange [0:1]
set xtics 10
set ytics 1e-3


set data style lines
set cntrparam bspline
set cntrparam points 7
set cntrparam levels 300
set contour
set nosurface
#set key off
set view 0,0
set table 'mathieuplot4p1.dat'
splot 'mathieu4.out' 

#quit

set contour base
unset cntrparam
set cntrparam bspline
set cntrparam points 7
set cntrparam levels discrete -0.0001
set table 'mathieuplot4p2.dat'
splot 'mathieu4.out' 

#set terminal epslatex color solid
#set output 'mathieuplotmode4.tex'
set terminal postscript color solid
set output 'mathieuplotmode4.ps'

set parametric
unset xtics
set logscale x
set xrange [500:30000]
set grid 
set yrange [0:1e-4]
#set mxtics 5
set ytics 1e-5
xi(i) = i < 2 ? 3.8320 : i < 3 ? 7.0156 : i < 4 ? 10.1730 : i < 5 ? 13.3518 : i 
< 6 ? 16.4934 : i < 7 ? 19.6350 : i < 8 ? 22.7765 : i < 9 ? 25.9181 : i < 10 ? 
29.0597 : i < 11 ? 32.2013 : i < 12 ? 35.3429 : i < 13 ? 38.4845 : i < 14 ? 
41.6261 : i < 15 ? 44.7677 : i < 16 ? 47.9093 : i < 17 ? 51.0509 : i < 18 ? 
54.1925 : i < 19 ?  57.3341 : i < 20 ? 60.4757 : 63.6173
h=5e-3
R=1e-3
g=9.81
sigma=0.0728
rho=1000
p(t,ximn)=4*ximn*tanh(ximn*h)/(R*t**2)*(g+ximn**2*sigma/rho)
q(t,Z0,ximn)=2*ximn*Z0*tanh(ximn*h)/R
om(t)=2*pi*t

k(i)=xi(i)/R
omegamn(i)=sqrt((g+sigma*k(i)**2/rho)*k(i)*tanh(k(i)*h))
f(i)=omegamn(i)/(2*pi)
nz(i)=2*k(i)*tanh(k(i)*h)
print f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8), f(9), f(10), f(11), f(12)

set trange [10:200]

# plot 'mathieuplot4p1.dat' using ($2)*4*f(1):($1)/nz(1) notitle lt rgb "red"  
,\
#      'mathieuplot4p1.dat' using ($2)*4*f(2):($1)/nz(2) notitle lt rgb "blue"  
,\
#      'mathieuplot4p1.dat' using ($2)*4*f(3):($1)/nz(3) notitle lt rgb "green" 
 ,\
#      'mathieuplot4p1.dat' using ($2)*4*f(4):($1)/nz(4) notitle lt rgb 
"yellow"  ,\
#      'mathieuplot4p1.dat' using ($2)*4*f(5):($1)/nz(5) notitle lt rgb "cyan"  
,\
#      'mathieuplot4p1.dat' using ($2)*4*f(6):($1)/nz(6) notitle lt rgb 
"purple"  ,\
#      'mathieuplot4p1.dat' using ($2)*4*f(7):($1)/nz(7) notitle lt rgb "red"  
,\
#      'mathieuplot4p1.dat' using ($2)*4*f(8):($1)/nz(8) notitle lt rgb "blue"  
,\
#      'mathieuplot4p1.dat' using ($2)*4*f(9):($1)/nz(9) notitle lt rgb "green" 
 ,\
#      'mathieuplot4p1.dat' using ($2)*4*f(10):($1)/nz(10) notitle lt rgb 
"yellow"  ,\
#      'mathieuplot4p1.dat' using ($2)*4*f(11):($1)/nz(11) notitle lt rgb 
"cyan"  ,\
#      'mathieuplot4p1.dat' using ($2)*4*f(12):($1)/nz(12) notitle lt rgb 
"purple"    
     


plot 'mathieuplot4p1.dat' using ($2)*4*f(1):($1)/nz(1) notitle lt rgb "red"  ,\
     'mathieuplot4p2.dat' using ($2)*4*f(1):($1)/nz(1) notitle lt rgb "red",\
     'mathieuplot4p1.dat' using ($2)*4*f(2):($1)/nz(2) notitle lt rgb "blue"  ,\
     'mathieuplot4p2.dat' using ($2)*4*f(2):($1)/nz(2) notitle lt rgb "blue", \
     'mathieuplot4p1.dat' using ($2)*4*f(3):($1)/nz(3) notitle lt rgb "green"  
,\
     'mathieuplot4p2.dat' using ($2)*4*f(3):($1)/nz(3) notitle lt rgb "green", \
     'mathieuplot4p1.dat' using ($2)*4*f(4):($1)/nz(4) notitle lt rgb "yellow"  
,\
     'mathieuplot4p2.dat' using ($2)*4*f(4):($1)/nz(4) notitle lt rgb "yellow", 
\
     'mathieuplot4p1.dat' using ($2)*4*f(5):($1)/nz(5) notitle lt rgb "cyan"  ,\
     'mathieuplot4p2.dat' using ($2)*4*f(5):($1)/nz(5) notitle lt rgb "cyan",\
     'mathieuplot4p1.dat' using ($2)*4*f(6):($1)/nz(6) notitle lt rgb "purple"  
,\
     'mathieuplot4p2.dat' using ($2)*4*f(6):($1)/nz(6) notitle lt rgb "purple", 
\
     'mathieuplot4p1.dat' using ($2)*4*f(7):($1)/nz(7) notitle lt rgb "red"  ,\
     'mathieuplot4p2.dat' using ($2)*4*f(7):($1)/nz(7) notitle lt rgb "red",\
     'mathieuplot4p1.dat' using ($2)*4*f(8):($1)/nz(8) notitle lt rgb "blue"  ,\
     'mathieuplot4p2.dat' using ($2)*4*f(8):($1)/nz(8) notitle lt rgb "blue", \
     'mathieuplot4p1.dat' using ($2)*4*f(9):($1)/nz(9) notitle lt rgb "green"  
,\
     'mathieuplot4p2.dat' using ($2)*4*f(9):($1)/nz(9) notitle lt rgb "green", \
     'mathieuplot4p1.dat' using ($2)*4*f(10):($1)/nz(10) notitle lt rgb 
"yellow"  ,\
     'mathieuplot4p2.dat' using ($2)*4*f(10):($1)/nz(10) notitle lt rgb 
"yellow", \
     'mathieuplot4p1.dat' using ($2)*4*f(11):($1)/nz(11) notitle lt rgb "cyan"  
,\
     'mathieuplot4p2.dat' using ($2)*4*f(11):($1)/nz(11) notitle lt rgb "cyan"
     
#      'mathieuplot4p1.dat' using ($2)*4*f(12):($1)/nz(12) notitle lt rgb 
"purple", \     
#      'mathieuplot4p2.dat' using ($2)*4*f(12):($1)/nz(12) notitle lt rgb 
"purple",\
#      'mathieuplot4p1.dat' using ($2)*4*f(13):($1)/nz(13) notitle lt rgb "red" 
 ,\
#      'mathieuplot4p2.dat' using ($2)*4*f(13):($1)/nz(13) notitle lt rgb 
"red",\
#      'mathieuplot4p1.dat' using ($2)*4*f(14):($1)/nz(14) notitle lt rgb 
"blue"  ,\
#      'mathieuplot4p2.dat' using ($2)*4*f(14):($1)/nz(14) notitle lt rgb 
"blue", \
#      'mathieuplot4p1.dat' using ($2)*4*f(15):($1)/nz(15) notitle lt rgb 
"green"  ,\
#      'mathieuplot4p2.dat' using ($2)*4*f(15):($1)/nz(15) notitle lt rgb 
"green", \
#      'mathieuplot4p1.dat' using ($2)*4*f(16):($1)/nz(16) notitle lt rgb 
"yellow"  ,\
#      'mathieuplot4p2.dat' using ($2)*4*f(16):($1)/nz(16) notitle lt rgb 
"yellow", \
#      'mathieuplot4p1.dat' using ($2)*4*f(17):($1)/nz(17) notitle lt rgb 
"cyan"  ,\
#      'mathieuplot4p2.dat' using ($2)*4*f(17):($1)/nz(17) notitle lt rgb 
"cyan",\
#      'mathieuplot4p1.dat' using ($2)*4*f(18):($1)/nz(18) notitle lt rgb 
"purple"  ,\
#      'mathieuplot4p2.dat' using ($2)*4*f(18):($1)/nz(18) notitle lt rgb 
"purple"
     
#'mathieuplot4p1.dat' using ($2)*4*f(2):($1)/nz(2) notitle lt rgb "green"  
,'mathieuplot4p2.dat' using ($2)*4*f(2):($1)/nz(2) notitle lt rgb "green", 
'mathieuplot4p1.dat' using ($2)*4*f(3):($1)/nz(3) notitle lt rgb "blue"  
,'mathieuplot4p2.dat' using ($2)*4*f(3):($1)/nz(3) notitle lt rgb "blue"
#pause -1

Reply via email to