x^{3}- 2xy + y^{3}>0

The way to do this is to define a function that has a constant value, if the inequality holds true, and has an indefinite value, if this is not the case. The value of 1/0 is quietly ignored in gnuplot, thus we can define our function as follows

f(x,y)=(x*x*x - 2*x*y + y*y*y>0)?1:1/0

where we used the ternary operator, which always has the form

A?B:C

i.e., returns 'B', if 'A' is true, and 'C' otherwise. (Incidentally, the value 'B' can be a ternary operator in itself, and in this way, multiple conditions can be imposed.) In the function above, f(x,y) = 1, if x

^{3}- 2xy + y

^{3}>0, and f(x,y) = 1/0 (undefined), if x

^{3}- 2xy + y

^{3}<0. Once we defined our function, we can plot it in the usual way. The complete script and the figure is given below.

reset f(x,y)=(x*x*x - 2*x*y + y*y*y>0)?1:1/0 unset colorbox set isosample 300, 300 set xlabel 'x' set ylabel 'y' set sample 300 set pm3d map splot [-2:2] [-2:2] f(x,y) t 'x^3 - 2xy + y^3>0'

It's great, but horizontal and vertical scales don't match. How fix this?

ReplyDelete@physicsworks:

ReplyDeleteset size ratio -1

See http://t16web.lanl.gov/Kawano/gnuplot/plot1-e.html#5.4.