使用gnuplot绘制Eudoxus的Kampyle。

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

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 1000set 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)
### 脚本结束

结果:

使用gnuplot绘制Eudoxus的Kampyle。

英文:

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:

使用gnuplot绘制Eudoxus的Kampyle。

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

发表评论

匿名网友

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

确定