我怎样才能在gnuplot中表达这个等式?

j0h*_*j0h 1 expression gnuplot

在gnuplot中,我将如何表达这样的内容:

在此输入图像描述

Mic*_*nas 7

为了表达不平等,我们将使用三元运算符,其中(伪代码)

if CONDITION:
    DO_A
else:
    DO_B
Run Code Online (Sandbox Code Playgroud)

表达为

CONDITION ? DO_A : DO_B
Run Code Online (Sandbox Code Playgroud)

所以在我们的例子中,

if a != x:
    f(x) = (a - x)**(0.04)
else:
    f(x) = 0
Run Code Online (Sandbox Code Playgroud)

表达为

f(x,a) = (a != x) ? (a - x)**(0.04) : 0
Run Code Online (Sandbox Code Playgroud)

请注意,我们将第25个根或n ^(1/25)表示为n ^(0.04).

绘制此等式将如下所示:

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)
Run Code Online (Sandbox Code Playgroud)

产量 Gnuplot输出

另一种表达方式就是简单地做

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)
Run Code Online (Sandbox Code Playgroud)

产量 在此输入图像描述

在第二张图像中,Gnuplot绘制了等式的虚部(即,当x> a时).