how can I express this equation in gnuplot?

In gnuplot, how would I express something like this:

Answers


To express inequality, we'll use the ternary operator, where (in pseudocode)

if CONDITION:
    DO_A
else:
    DO_B

is expressed as

CONDITION ? DO_A : DO_B

so in our case,

if a != x:
    f(x) = (a - x)**(0.04)
else:
    f(x) = 0

is expressed as

f(x,a) = (a != x) ? (a - x)**(0.04) : 0

Note that we are expressing the 25th-root, or n^(1/25), as n^(0.04).

Plotting this equation will look something like the following:

reset
f(x,y) = (y != x) ? (y - x)**(0.04) : 0
unset colorbox
set isosample 300, 300
set xlabel 'x'
set ylabel 'y'
set title '(y - x)^{0.04} != 0'
set sample 300
set pm3d map
splot [-500:500] [-500:500] f(x,y)

which yields

Another way to express this is to simply do

reset
f(x,y) = (y - x)**(0.04) != 0
unset colorbox
set isosample 300, 300
set xlabel 'x'
set ylabel 'y'
set title '(y - x)^{0.04} != 0'
set sample 300
set pm3d map
splot [-500:500] [-500:500] f(x,y)

which yields

In this second image, Gnuplot is plotting the imaginary part of the equation (i.e., when x > a).


Need Your Help

jQuery UI, Drag and Drop is not functioning properly if helper option is set to “clone”

jquery jquery-ui drag-and-drop

when a draggable item's helper property is "clone" and then when dropped, its not working.

get pixel color in instance

c# .net graphics pixel

I was searching through the posts on this site and i came across this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.