English 中文(简体)
Random 步行
原标题:Random walk- Brownian Motion
  • 时间:2012-04-08 23:12:53
  •  标签:
  • c++
  • random

我先被分配到一个简单的ole子项目,该模型在2D飞机上提出了own。 我没有获得多少资料,说明如何这样做(我希望这只是一个很受欢迎的任务,以便我能够了解一些看法),而这正是它依赖随机的生成。 我对英国人提出的略微小一点动议进行了研究,并看到了一些复杂公式,但根据描述,似乎必须在一定间隔内随机迁移。 谁能澄清? 我建议制定一项方案,在间隔期内不断生成随机数量,然后修改“x”和“y”的微粒,或者对它进行更多的协调?

Thanks for any help.

最佳回答

考虑到随机动议不是“统一”,而是如果你策划运动的频率与运动距离相距,你就会看到,大多数行动是短暂的,有些是较长的,有些是很长的,造成一些情况急剧下降。

我可以回顾一下该动议所观察到的统计曲线,但你或许可以说出这一点,然后,你需要随机设计出一个能够产生符合这一曲线的价值的发电机。

我要做的是利用这个全国过渡政府计算距离,然后使用一个统一的全国过渡政府计算角,从零到2*pi,使动议极化。 你可以单独计算一个随机X和一个随机Y,但我不敢肯定你得到同样的分配。

问题回答

布朗利动议是随机抽空分子击中微粒的结果。 由于随机部队的总和不大可能确切为零,而粒子的体质如此之小,看来会围绕Brownian的动议进行争.。 因此,你收到一份动议,看来是随机的,但并非统一。

模型的 d路是,为了数百个气.的势头,为方向和加西分配进行统一分配,将碰撞与颗粒相撞,并获取这笔钱。 很多时候,你们都会提出布朗利人类型的动议。 (单个空气分子的平均动力取决于温度,而空气分子的数量取决于压力。)

请注意,由此产生的动议不是Gaussian,而是Gaussian分发的许多样本的总和。 不知道它所说的话。

你的问题令人费解。 这几乎肯定是你的过错,因为你的教员本应向你们指出,妥善执行布朗利动议,甚至在你开始编码之前,需要大量和大量精细地具体地说明和分析问题领域。

布朗利动议的确切定义可能不会给你带来任何影响,除非你在衡量理论方面选择相关课程。 然而,该网拥有大量资源,充分描述了伊特奥进程(Brownian的动议就是例子)。

如果你重新希望巩固这一进程,那就是一个体面的管道。 在某些阶段,你再次需要生成随机数字。 几乎肯定,你会再次有兴趣从正常分配中受益。 令人欣慰的是,C++方案管理员可以采取一些重大方法这样做。 我赞成的是利用“博恩”。 Random图书馆(或C++11的相关图书馆)。 试测战略是使用功能物体生成随机变体,可能采用蒸气炉:

#include <iostream>
#include <vector>
using namespace std;

#include <boost/random/mersenne_twister.hpp>
#include <boost/random/normal_distribution.hpp>
#include <boost/random/variate_generator.hpp>

int main()
{
  // Some typedefs to help keep the code clean
  // Always a good idea when using Boost!
  typedef boost::mt19937                                      T_base_prng;
  typedef boost::normal_distribution<>                        T_norm_varg;
  typedef boost::variate_generator<T_base_prng&, T_norm_dist> T_norm_varg;

  unsigned int base_seed = 42;  // Seed for the base pseudo-random number generator
  double       mean      = 0.0; // Mean of the normal distribution
  double       stdev     = 1.0; // Standard deviation of the normal distribution
  T_base_prng  base_prng(base_seed); // Base PRNG
  T_norm_dist  norm_dist(mean, stdev); // Normal distribution
  T_norm_varg  norm_varg(base_prng, norm_dist); // Variate generator

  // Generate 1000 draws from a standard normal distribution
  vector<double> drawVec(1000);
  for (vector<double>::iterator iter = drawVec.begin(); 
       iter != drawVec.end(); ++iter)
  {
    *iter = norm_varg();
  }

  // More stuff...


  return 0;
}

一旦你处理布朗人的动议,就应该用“博恩”的功能来树立一些榜样。 Random.

是的,你只需要在每个步骤的<代码>x和y上添加随机编号:

int x=0, y=0;

for (int t=0; t<N; t++) {
    x += distribution(gen);
    y += distribution(gen);
    display(x, y);
}

分配可以简单地作为<代码>{0,1}、间隔或瓜西an分配。

<><>Edit>: 对于非常大的N来说,你可以衡量平均距离R = d(x,y),并检查其是否像t ~ R^2。 当然,为了保持关系,上述法典只能产生一个布朗利动议,你必须重复许多时间。 试验。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签