英文:
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)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论