python三维随机游走轨迹模拟_Mathematica简单的三维随机游走及实现

Mathematica简单的三维随机游走及实现

三维随机游走

以下几个比较简单版本

Graphics3D[ FoldList[Normal@GeometricTransformation[#, TranslationTransform[#2]] &, Cuboid[], RandomChoice[Permutations[{1, 0, 0}], 50]], Boxed -> False]

lattice = Table[Take[Join[{0, 0}, IntegerDigits[i, 2]], -3], {i, 1, 8}] /. {0 -> -1};

data = Accumulate[Table[lattice[[RandomInteger[{1, 8}]]], {200}]];

Graphics3D[Tube[data]]

动画

posList = FoldList[Normal@GeometricTransformation[#, TranslationTransform[#2]] &, Cuboid[],RandomChoice[Permutations[{1, 0, 0}], 50]];plot := Graphics3D[#, PlotRange -> {100, 100, 100}] &

graphList = Table[Graphics3D[posList[[1;;i]], PlotRange -> 40, Boxed -> False], {i, 1, 51}];

ListAnimate@graphList

隐藏一些帧,剑拖尾效果

plot := Graphics3D[#, PlotRange -> {100, 100, 100}] &

takeData[data0_, i0_] := Block[{},len = Length@data0;

If[len > i0, data0[[-i0;;-1]], data0]]

graphList = Table[Graphics3D[takeData[posList[[1;;i]], 10], PlotRange -> {0, 20}, Boxed -> False], {i, 1, 51}];

ListAnimate@graphList

这篇是好早前的博文,新函数AngelPath3D等更方便。

<< "/Users/hypergroups/Documents/Wolfram \Mathematica/DeployProjects/MyMarkDown.m"

Notebook2Markdown[EvaluationNotebook[], "random_walk"]

喜欢的多多表示,点个赞加个星,后面有空分享更多有趣的小例子。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值