# setting the parametric indication
set parametric
# setting the grid
set grid
# setting the aspect ratio of graph
set size ratio -1
# setting the start angle of Archimedes spiral,
# ''θ0'' and end angle, ''θ1'' [rad]
t0=8*pi # lower limits of integral interval
t1=100 # upper limits of integral interval
# setting the number of sample N
N=10000 # divided numbers of integral interval
# rotation angle of inner end a [rad]
a=5.5
# entire length of Archimedes spiral L
L=0.5*(t1*sqrt(1+t1**2)+log(t1+sqrt(1+t1**2))\
-t0*sqrt(1+t0**2)-log(t0+sqrt(1+t0**2)))
# integrand
f(t)=-a/L*sqrt(1+t**2)*(t*cos(t)*sin(a*(L-s)/L)\
+t*sin(t)*cos(a*(L-s)/L)) # integrand of real part
g(t)=a/L*sqrt(1+t**2)*(t*cos(t)*cos(a*(L-s)/L)\
-t*sin(t)*sin(a*(L-s)/L)) #integrand of imaginary part
set trange [t0:t1]
set samples N+1
# writing down the data to separate file
set table "table10.txt"
plot lastx=0.0,lastyr=0.0,lastyi=0.0,integr = 0.0,\
integi = 0.0,old1=0,old2=0,old3=0,\
integzr=0,integzi=0,integL=0,\
"+" using 1 : (dx=$1-lastx, \
s=0.5*($1*sqrt(1+$1**2)+log($1+sqrt(1+$1**2))\
-t0*sqrt(1+t0**2)-log(t0+sqrt(1+t0**2))),\
integr = ($0==0 ? 0.0:integr+dx*(f($1)+lastyr)*0.5), \
integi = ($0==0 ? 0.0:integi+dx*(g($1)+lastyi)*0.5), \
lastx=$1, \
lastyr=f($1), \
lastyi=g($1),\
zr=integr+$1*cos($1)*cos(a*(L-s)/L)\
-$1*sin($1)*sin(a*(L-s)/L),\
zi=integi+$1*cos($1)*sin(a*(L-s)/L)\
+$1*sin($1)*cos(a*(L-s)/L),\
dzx=($0==0 ? 0.0 : zr-old1),\
dzy=($0==0 ? 0.0 : zi-old2),\
dL=sqrt(dzx**2+dzy**2),\
integzr=integzr+(zr+old1)*0.5*dL,\
integzi=integzi+(zi+old2)*0.5*dL,\
integL=dL+old3,\
old1=zr,\
old2=zi,\
old3=integL,\
zr) : (zi) : (integL) : (integzr/L) : (integzi/L)\
w xyerrorbars
unset table
# setting the kinds of lines of graph
set style line 1 linetype 1
set style line 1 linecolor -1
set style line 1 linewidth 2
set style line 1 linetype 1
set style line 1 linecolor 1
set style line 1 linewidth 1
# setting the range of x and y axes
set xrange [-150:150]
set yrange [-150:150]
# setting the label of x and y axes
set xlabel "x/a"
set ylabel "y/a"
# graphing
plot "table10.txt" u 2:3 w l linestyle 1 notitle
# drawing the coordinates of the center of gravity
replot integzr/L,integzi/L w p title "G(x,y)"
# drawing the collet
replot t0* cos(t),t0*sin(t) w l linestyle 2 notitle
# designating the output format and option
set terminal jpeg
# designating the output file name
set output "jiyuutanhige5.jpeg"
# regraphing
replot
# resetting the format and output
set output
set terminal win
[EOF]