Search code examples
gnuplot

Kronecker delta in gnuplot for windows


Does anyone know whether there exists a mathematical artifact in gnuplot (for windows) that reproduces the Kronecker delta? As an example (taken from fortran): 0^(i-j) gives 1 if i=j, 0 otherwise since 0^(any number other than zero)=0 but 0^0= 1 in fortran; unfortunately, gnuplot gives 0 for all cases, so I need to search a different way. I've tried (1.e-15)^0 which should give 1 (while 1.e-15^(any other number is practically 0)), but then I get the message 'non-integer passed to boolean operator'. Likewise with 0^(1.e-15). Any idea ?


Solution

  • @Ethans answer is the straight forward way.

    But why does your attempt not work?

    0^(i-j) does not work because ^ is the "bitwise exclusive OR" operator. Exponentiation is **, and I would take the absolute value:

    0**abs(i-j)
    

    See help operators binary.