If command in shell script

for i in $(seq 0 $2)
for j in $(seq 0 $2)

if [ “$i” -ge “$1” ] || [ “$j” -ge “$1” ] ; then # or $j>=$a
echo “time math -script jQcoeffs.m $2 $i $j”


Courtesy — Pranav

Continue reading If command in shell script


Make gnuplot column as a variable

Consider a case where there is a complicated manipulation of the columns which you wish to do before final plotting. The expression can be made into a variable

a = ‘column(4)/column(3)’
but this will not work if you just put the system as

pl … u 1:a ..

One needs to use this

pl[][] filename1 u 1:(@a) ..




Discontinuous patches in surface plot


Sometimes surface plots (Plot3D) in Mathematica can show discontinuous patches.

Use exclusions none (Make sure the exclusions are unphysical)


Plot3D[Re[Bands[J1val, J2val, kxval, kyval]], {kxval, kxv – delta,
kxv + delta}, {kyval, kyv – delta, kyv + delta}, Exclusions -> None]

courtesy and more details:


gnuplot script file

do for [a=1000:2000] {
set term x11 0
pl ‘./GenEigfun_107.txt’ u 1:2:3 every :::a::a w p pt 7 ps 2 palette t sprintf(“%.3f”,a)
set term x11 1
set arrow from a, graph 0 to a, graph 1 nohead
pl ‘./GenEigen_107.txt’ u 3 w p t sprintf(“%.3f”,a)
unset arrow
pause 0.5

opens two windows, plots the eigenfucntions (1000-2000) as you move through the eigenvalues