#! /bin/sh # # generate stdev plot from bj.sh results echo "Creating data/stdev.txt and data/stdev.gif" n=8; t=8 for m in $(seq 8 17) do f="data/$n-$m-$t.txt" Q=$(tail -n 1 "$f" | awk '{ print $NF }') # stdev M=$(head -n 1 "$f" | awk '{ gsub(/,/," "); print lshift(1,$7); }') # 2**m C=$(echo "$M" | awk '{ M=$1; p=8/169; q=1-p; print 169*sqrt(p*q/M); }') echo "$M $C $Q" done > data/stdev.txt title="standard deviation vs. sample size" xlabel="number of samples" ylabel="standard deviation" labels="set title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" labels="$labels\nset xrange [256:131072]" printf "set logscale xy\nset term gif\nset output\n$labels\nset key right top\nplot\ 'data/stdev.txt' using 1:2 with linespoints lc rgb 'red' title 'classical',\ 'data/stdev.txt' using 1:3 with linespoints lc rgb 'blue' title 'quantum'\n" | gnuplot > data/stdev.gif