Code Monkey home page Code Monkey logo

random-walks's Introduction

Simulate random walks in one, two, or three dimensions

This repository contains scripts for simulating random walks in one, two, and three dimensions. It includes R scripts for 1D and 2D simulations, and a Python script for the 3D simulation. Agents move randomly within their respective spaces, and the scripts visualize these trajectories. Parameters to control the number of agents, number of steps per agent, and random or centralized starting positions (2D, 3D) are configurable.

Features

  • One-dimensional random walk simulation (1d_random_walk.R)
  • Two-dimensional random walk simulation (2d_random_walk.R)
  • Three-dimensional random walk simulation (3d_random_walk.py)

License

This code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

Usage

To run the R simulations, you will need R installed on your computer. You can then execute the desired script in an R environment.

To run the Python simulation, ensure that Python is installed on your computer and execute the desired script.

Parameters

Modify the following parameters within each script to customize the simulations:

  • n_agents: Number of agents in the simulation.
  • n_walks: Number of steps each agent takes.
  • random_starts (2D, 3D): Determines if agents start randomly or at the origin.
  • start_range (2D, 3D): If random_starts is True, sets the area for randomizing start positions.

Installation

No additional installations are required beyond R (for R scripts) and the standard Python scientific libraries (for the Python script). To run the scripts, clone this repository or download the script files and execute it within the appropriate environment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.