Code Monkey home page Code Monkey logo

crs05's Introduction

CRS04 Exercise

Team Members

  • Minsol Kim
  • Bhargav Solanki

Overview

This repository hosts our group's submission for Task Sheet 4 of Collective robotics and scalability.

Task 5.1: Buffon's Needle

file name: buffon.py

Description

Buffon's Needle problem is a classic probability puzzle that involves dropping a needle of length b onto a plane ruled with parallel lines spaced s apart. The goal is to determine the probability P that the needle will intersect one of the lines and use this probability to approximate π.

Implementation

  • Simulation: The simulation involves dropping a needle on a single line segment of width s and checking if it intersects based on the needle’s angle and distance from the center to the nearest line.
  • Intersection Probability: The intersection probability P is calculated and used to estimate π according to the formula: [ \pi \approx \frac{2b}{sP} ]

Code Explanation

  • simulate_buffon_needle(n, b, s): Simulates n needle drops, returning the intersection probability.
  • estimate_pi(P, b, s): Estimates π using the intersection probability.
  • experiment_and_plot(): Conducts experiments and plots the standard deviation.
  • confidence_intervals(): Computes and plots the confidence intervals.
  • outside_confidence_ratio(): Measures and plots the ratio of experiments outside the confidence interval.

What We Encountered

Problem: In Task 5.1.d, the ratio of experiments for which the true probability was outside the 95% confidence interval was always 0. This suggests that the estimated probabilities always fell within the expected range, which is statistically unlikely. Also, we reduced the number of experiments from 10000 to 100 since running the code was too slow.

Potential Reasons:

  1. Given the random nature of the experiments, it's possible that the simulation results are showing a rare scenario where the estimates are unusually accurate. However, this should not consistently result in a ratio of 0 over many trials.

  2. There may be a bug or incorrect implementation in calculating the 95% confidence intervals. The intervals may be too wide, consistently covering the true probability.

Task 5.2: Local Sampling in a Swarm

file name: local_sampling.py

plot results: task5.2_plot.png

This task simulates a swarm of robots uniformly distributed over a unit square. Each robot is randomly assigned a color, either black or white, with equal probability. The goal is for each robot to estimate the overall number of black robots in the swarm based on local observations of its neighbourhood, defined by a sensor range r= [0.1, 0.2, 0.3, 0.4, 0.5].

Consequences: The robot swarm's effectiveness may depend on an accurate estimate of the number of black robots, so sensor range and swarm are crucial. The larger the sensor range better the accurate and reliable estimates.

crs05's People

Contributors

minsol21 avatar bhargavsinh-solanki avatar

Watchers

 avatar

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.