# trajectory of shift in center of gravity of free-end spring
# 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
t1=100
# 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)))
# setting the range of the rotation angle of balance t [rad]
set trange [-5.5:5.5]
# setting the numbers of sample
set samples 1000
# writing down the data to separate file
set table "table2.txt"
plot "+" using 1 : (a=t,\
Dx=(t1**2*(L-t*t1)-t*t1**2*(-t1))*cos(t1)/(L-t*t1)**2\
-(2*t1*(L-2.5*t*t1)\
-2*t*t1*(-2.5*t1))*sin(t1)/(L-2.5*t*t1)**2\
-(t0**2*(L-t*t0)-t*t0**2*(-t0))*cos(t+t0)/(L-t*t0)**2\
+t*t0**2*sin(t+t0)/(L-t*t0)+(2*t0*(L-2.5*t*t0)\
-2*t*t0*(-2.5*t0))*sin(t+t0)/(L-2.5*t*t0)**2\
+2*t*t0*cos(t+t0)/(L-2.5*t*t0),\
Dy=(t1**2*(L-t*t1)-t*t1**2*(-t1))*sin(t1)/(L-t*t1)**2\
+(2*t1*(L-2.5*t*t1)\
-2*t*t1*(-2.5*t1))*cos(t1)/(L-2.5*t*t1)**2\
-(t0**2*(L-t*t0)-t*t0**2*(-t0))*sin(t+t0)/(L-t*t0)**2\
-t*t0**2*cos(t+t0)/(L-t*t0)-(2*t0*(L-2.5*t*t0)\
-2*t*t0*(-2.5*t0))*cos(t+t0)/(L-2.5*t*t0)**2\
+2*t*t0*sin(t+t0)/(L-2.5*t*t0),\
Dy) : (-Dx) : (0) : (0) : (0) w xyerrorbars
unset table
# setting the range of x and y axes
set xrange [-2:0]
set yrange [-2.5:-0.5]
# setting the label of x and y axes
set xlabel "x/a"
set ylabel "y/a"
# setting the kinds of lines of graph
set style line 1 linetype 1
set style line 1 linecolor -1
set style line 1 linewidth 4
# graphing
plot "table2.txt" using 2:3 w l linestyle 1 notitle
# designating the output format and option
set terminal jpeg
# designating the output file name
set output "jyuushinidou.jpeg"
# regraphing
replot
# resetting the format and output
set output
set terminal win
[EOF]