Skip to content

Instantly share code, notes, and snippets.

@pfactum
Created May 14, 2014 18:38
Show Gist options
  • Save pfactum/d734e3ce22d7628774fd to your computer and use it in GitHub Desktop.
Save pfactum/d734e3ce22d7628774fd to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
index="0"
sum1="0"
sum2="0"
sum1n="2080"
sum2n="4.74389090370576902576"
echo -n "" >test.out
for i in $(seq 1 64)
do
sum1=$(echo "$sum1+$i/$sum1n" | bc -l)
sum2=$(echo "$sum2+(1/$i)/$sum2n" | bc -l)
echo -e "$i\t$sum1\t$sum2" >>test.out
done
echo "plot 'test.out' using 1:2 with lines title 'int', 'test.out' using 1:3 with lines title 'float'" | gnuplot -persist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment