画不出电场偶极子

Can't draw electric field dipole

我正在尝试使用 Maxima 模拟电场偶极子。 这是代码:

P : 1$
eps0 : 8.854$
Ex : 3*P*y*x/(4*π*eps0*(x^2 + y^2)^2.5)$
Ey : P*(3*y^2/(x^2 + y^2) + 1)/(x^2 + y^2)^1.5/(4*π*eps0)$
ew : sqrt(Ex^2 + Ey^2)$

contour_plot (ew,[x, -4, 4], [y, -4,4]);

但我得到的只是直线。
可能有什么问题,因为 Wolfram Mathematica 中的类似代码工作正常。

contour_plot 不如 Mathematica 中相应的函数聪明。你可以帮它一点。

P : 1$
eps0 : 8.854$
Ex : 3*P*y*x/(4*%pi*eps0*(x^2 + y^2)^2.5)$
Ey : P*(3*y^2/(x^2 + y^2) + 1)/(x^2 + y^2)^1.5/(4*%pi*eps0)$
ew : sqrt(Ex^2 + Ey^2)$

BIG: subst([x=1/4, y=1/4], ew)$
cap_log(e, c):= if e > c then log(c) else log(e)$

set_plot_option ([gnuplot_preamble, "set cntrparam levels 8"])$
contour_plot ('cap_log(ew, BIG), [x, -4, 4], [y, -4, 4])$

你也可以使用plotdf。

(%i1) [P,eps0] : [1,8.854]$
(%i2) Ex : 3*P*y*x/(4*%pi*eps0*(x^2 + y^2)^2.5)$
(%i3) Ey : P*(3*y^2/(x^2 + y^2) + 1)/(x^2 + y^2)^1.5/(4*%pi*eps0)$
(%i4) plotdf([Ex,Ey],[vectors,"blank"]);

点击绘图中的一些点,然后进入绘图设置菜单(带有扳手和螺丝刀的图标),擦除场线中的颜色"red"并选择一种颜色,例如"blue",在曲线中。 Return 单击“确定”转到绘图,然后再次单击绘图以绘制几条等势曲线。