Giter Club home page Giter Club logo

montecarlovisualization's Introduction

Monte Carlo Visualization in .NET WPF

The application let's you visualize π approximation. Written using Windows Presentation Foundation.

Usage

If you just want to run the application you can download the dist/ folder. Then double click on MonteCarloVisualization.application

MonteCarloVisualization

Requirements

Application runs only under Windows. If you don't have .NET run time installed run dist/setup.exe

Monte Carlo π Approximation

Implementation

The implementation takes a random point inside the square and checks if that point lies within the circle. The ratio of points inside the circle to all generated points is p. Multiplying p by 4 gives the approximate value of π.

Fixed number of points

Calculates π value for given number of points.

Iterative approximation

Calculates π value in multiple steps, each time for different number of points. You can see as the animation progresses the value of π is approximated with better accuracy.

Remarks

1. WPF is not the best technology to draw a lot of points on Canvas. The default mechanisms of the framework don't support such oppertations.

First of all UI is single thread so each paint operation freezes the application (keep in mind freeze the application is something different than disabling UI controls). The solution works this way:

  • Shapes (rectangle and circle) are drawn on canvas
  • All points are drawn to WritableBitmap which is later drawn on Image This way the application performance is much better

2. UI clickable elements are disable when animation is in progress

3. Most of the controls use data binding

4. XAML was created by Visual Studio designer

montecarlovisualization's People

Contributors

lberwid avatar lucky125111 avatar

Watchers

 avatar  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.