英文:
Plot the Kampyle of Eudoxus with gnuplot
问题
我希望用Gnuplot生成Eudoxus的Kampyle:
plot x*x*x*x = x*x + y*y
这段代码应该可以实现。然而,它返回以下错误:
plot x*x*x*x=x*x+y*y
^
"file.plt", line 1: unexpected or unrecognized token
有没有办法绘制这个图形?
英文:
I wish to generate the Kampyle of Eudoxus with Gnuplot:
plot x*x*x*x = x*x + y*y
This code should do the trick. However, it returns me the following error:
plot x*x*x*x=x*x+y*y
^
"file.plt", line 1: unexpected or unrecognized token
Is there a way to plot this?
答案1
得分: 1
以下是您要翻译的内容:
如果您查看gnuplot常见问题解答,您会发现不能直接绘制隐式定义的图形,但是有一种解决方法被描述。
默认的 samples
是100。为了增加精度,请设置 set samples 1000
和 set isosamples 1000
。
脚本:
### 绘制隐式图形
reset session
f(x,y) = x**4 - a*(x**2 + y**2)
a = 1
set samples 1000
set isosamples 1000
set contour base
set cntrparam levels discrete 0.0
unset surface
set table $CONTOUR
splot f(x,y)
unset table
set key top center
plot $CONTOUR w l lc "red" ti sprintf("\n\n欧多克索斯的Kampyle\nx^4 = a*(x^2 + y^2)\na = %g",a)
### 脚本结束
结果:
英文:
If you check the gnuplot FAQs you will find a note that you cannot plot implicit defined graphs directly, however, a workaround is described.
Default samples
is 100. So, in order to increase precision set samples 1000
and set isosamples 1000
.
Script:
### plot implicit graph
reset session
f(x,y) = x**4 - a*(x**2 + y**2)
a = 1
set samples 1000
set isosamples 1000
set contour base
set cntrparam levels discrete 0.0
unset surface
set table $CONTOUR
splot f(x,y)
unset table
set key top center
plot $CONTOUR w l lc "red" ti sprintf("\n\nKampyle of Eudoxus\nx^4 = a*(x^2 + y^2)\na = %g",a)
### end of script
Result:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论