简体   繁体   English

在 Julia 中绘制代数曲线

[英]Plotting Algebraic Curves in Julia

I'm looking to visualize some algebraic curves in Julia我希望在Julia可视化一些代数曲线

I have the polynomials:我有多项式:

f1=(x^4+y^4-1)(x^2+y^2-2)+x^5y f1=(x^4+y^4-1)(x^2+y^2-2)+x^5y

f2 = x^2+2xy^2-2y^2-1/2 f2 = x^2+2xy^2-2y^2-1/2

and I would like to plot V(f1) and V(f2) so I can see their common intersections.我想绘制 V(f1) 和 V(f2) 以便我可以看到它们的共同交叉点。 I have tried using contour plot in Gadfly.jl but it seems to only allow me to plot one curve at a time.我曾尝试在Gadfly.jl使用等高线图,但它似乎一次只允许我绘制一条曲线。 Is there a way to plot both curves in Gadfly.jl or doing it in another Julia package?有没有办法在Gadfly.jl或另一个Julia包中绘制两条曲线?

Here is what I have so far.这是我到目前为止所拥有的。 在此处输入图片说明

Gadfly is using a handy composite item: Layers Gadfly 正在使用一个方便的复合项目: Layers

https://gadflyjl.org/stable/man/compositing/#Layers https://gadflyjl.org/stable/man/compositing/#Layers

These are freely accessible through the plot as plot_name.layers and can be manually appended ( eg using append!(p.layers, new_layer) ).这些可以通过plot_name.layers自由访问,并且可以手动附加(例如使用append!(p.layers, new_layer) )。 A personal favorite is building both layers prior to calling plot() and implementing any necessary figure labels within the plot() function:个人最喜欢的是在调用plot()之前构建两个层并在plot()函数中实现任何必要的图形标签:

using Gadfly

pol_one = layer(z=(x,y) -> (x^4 + y^4 - 1) * (x^2+y^2-2) + x^5 * y,
               xmin=[-2], xmax=[2], ymin=[-2], ymax=[2],
               Geom.contour(levels=[0;]))

pol_two = layer(z=(x,y) -> x^2 + 2x*y^2 - 2y^2 - 1/2,
               xmin=[-2], xmax=[2], ymin=[-2], ymax=[2],
               Geom.contour(levels=[0;]))

plot(p_layer, q_layer, Guide.xlabel("x"), Guide.ylabel("y"))

which will produce the following figure:这将产生下图: 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM