快捷搜索:  汽车  科技

mathematica图形比例失调(用网络画板和Mathematica演示)

mathematica图形比例失调(用网络画板和Mathematica演示)Show[ListLinePlot[NestWhileList[f 108 #>2&] PlotRange->All] ListPlot[NestWhileList[f 108 #>2&]] ImageSize->{500 365} PlotRange->All]//Rasterize当初始值是108的时候,得到的图形是:Graph[Table[DirectedEdge[n f[n]] {n NestWhileList[f 100 #>2&]}] VertexLabels->"Name" ImageSize->{500 365}]在坐标轴上画出散点图:Show[ListLinePlot[NestWhileList[f 100 #>2&]] ListPlot[NestWhileList[f 100 #>

用Mathematica,可以先自定义函数:

  • f[x_]:=If[EvenQ[x] x/2 3*x 1]

然后运行如下代码:

  • f[x_]:=If[EvenQ[x] x/2 3*x 1]

  • NestWhileList[f 100 #>2&]

  • Graph[Table[DirectedEdge[n f[n]] {n NestWhileList[f 100 #>2&]}] VertexLabels->"Name" ImageSize->{500 365}]

mathematica图形比例失调(用网络画板和Mathematica演示)(1)

在坐标轴上画出散点图:

Show[ListLinePlot[NestWhileList[f 100 #>2&]] ListPlot[NestWhileList[f 100 #>2&]]]

mathematica图形比例失调(用网络画板和Mathematica演示)(2)

当初始值是108的时候,得到的图形是:

  • Show[ListLinePlot[NestWhileList[f 108 #>2&] PlotRange->All] ListPlot[NestWhileList[f 108 #>2&]] ImageSize->{500 365} PlotRange->All]//Rasterize

mathematica图形比例失调(用网络画板和Mathematica演示)(3)

  • Graph[Table[DirectedEdge[n f[n]] {n NestWhileList[f 108 #>2&]}] VertexLabels->"Name" ImageSize->{500 365}]//Rasterize

  • mathematica图形比例失调(用网络画板和Mathematica演示)(4)

    把初始值分别是100,200,……,900,1000对应的散点图画到一起:

    • Show[ListLinePlot[Table[NestWhileList[f n #>2&] {n 100 1000 100}] PlotRange->All] ListPlot[Table[NestWhileList[f n #>2&] {n 100 1000 100}]] ImageSize->{500 365} PlotRange->All]//Rasterize

    mathematica图形比例失调(用网络画板和Mathematica演示)(5)

    把初始值分别是1000,2000,……,9000,10000对应的散点图画到一起:

    • Show[ListLinePlot[Table[NestWhileList[f n #>2&] {n 1000 10000 1000}] PlotRange->All] ListPlot[Table[NestWhileList[f n #>2&] {n 1000 10000 1000}]] ImageSize->{1000 730} PlotRange->All]//Rasterize

    mathematica图形比例失调(用网络画板和Mathematica演示)(6)

    初始值是837799,需要迭代524次才能得到数字1,是1000000以内的数字,迭代次数最多的一个数,对应的迭代图像是:

    mathematica图形比例失调(用网络画板和Mathematica演示)(7)

    猜您喜欢: