Gnuplot使用函数f(x)=(abs(1-(x/0.001))**(-1/2))时出现异常。

huangapple go评论86阅读模式
英文:

Gnuplot goes crazy with the function f(x)=(abs(1-(x/0.001))**(-1/2))

问题

Gnuplot无法绘制该函数,但Mathematica可以。我尝试在Gnuplot中绘制以下函数:

f(x) = (abs(1-(x/0.001))**(-1/2))

但它给出了以下错误:空的y范围[1:1],调整为[0.99:1.01]

我去了Wolfram Alpha,它可以在区间(0.001,100]上绘制这样的函数。我尝试设置xrange和yrange(因为f(x)增长非常缓慢),但仍然没有得到图形。

您有关于如何绘制这样的函数的任何见解吗?

提前感谢。

英文:

Gnuplot does not let me plot a function but Mathematica does.

I am trying to plot the following function in gnuplot

f(x) = (abs(1-(x/0.001))**(-1/2))

But it gives me the following error: empty y range [1:1], adjusting to [0.99:1.01]

I went to wolfram alpha and it was capable of plotting such function over the domain (0.001,100]. I tried to set the xrange and yrange (at it seems that f(x) grows very slow) but then again no plot was given.

DO you have any insights on what to do in order to plot such a function?

Thanks in advance

答案1

得分: 1

Gnuplot 将 1/2 解释为整数运算,因此它的结果是零。添加小数点以指示浮点运算,一切都会正常。

f(x) = (abs(1-(x/0.001))**(-1/2.))
set yrange [0:.5]
plot f(x)

Gnuplot使用函数f(x)=(abs(1-(x/0.001))**(-1/2))时出现异常。

英文:

Gnuplot interprets 1/2 as integer arithmetic, so it evaluates to zero. Add
a decimal point to indicate floating point arithmetic and all will be well.

f(x) = (abs(1-(x/0.001))**(-1/2.))
set yrange [0:.5]
plot f(x)

Gnuplot使用函数f(x)=(abs(1-(x/0.001))**(-1/2))时出现异常。

huangapple
  • 本文由 发表于 2023年5月30日 10:07:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76361203.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定