从Mathematica过渡到Python

时间:2016-02-10 08:20:23

标签: python wolfram-mathematica

我有以下代码来绘制"共振线":

TuneDiagram[MyOrder_, MyColor_] := Module[{},
  myLines = 
   Partition[
    Flatten[Table[{{A -> a, B -> +MyOrder - a, C -> p}, {A -> a, 
        B -> -MyOrder + a, C -> p}}, {a, 0, MyOrder}, {p, -MyOrder, 
       MyOrder}]], 3];
  myEquation = A  x + B y == C /. myLines;
  ContourPlot[Evaluate[myEquation], {x, 0, 1}, {y, 0, 1}, 
   ContourStyle -> MyColor, PlotRangePadding -> None, 
   GridLines -> None, 
   ]]

我可以获得像这样的情节。

我希望使用Python / matplotlib获得相同的结果。

我对"翻译感到困惑"这种编程风格到Python上。任何指针都会非常感激!

enter image description here

0 个答案:

没有答案