mcpi

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

README

mcpi

GoDoc

mcpi provides a simple interface to draw (x,y) points for a Monte-Carlo approximation method to compute Pi.

mcpi starts a web server that will listen for plot requests.

Installation

Installation is done with go get:

$> go get github.com/master-pfa-info/mcpi

Example

func main() {
	mcpi.Wait()
	mcpi.Plot(0,0)
	mcpi.Plot(0.5, 0.5)
	mcpi.Quit()
}
$> go run ./main.go
2017/09/19 17:27:44 listening on 127.0.0.1:46191

and then direct your favorite web-browser to the indicated URL.

Sample

mc-pi

Documentation

Overview

Package mcpi provides a simple interface to plot (x,y) points from a Monte-Carlo approximation method to compute Pi.

Example:

mcpi.Wait() // wait for the web server to be ready
for i := 0; i < 100; i++ {
    mcpi.Plot(float64(i), float64(i))
}
mcpi.Quit()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Plot

func Plot(x, y float64)

Plot plots a point at (x,y)

func Quit

func Quit()

Quit closes the web plot server.

func Wait

func Wait()

Wait waits for the plot to be finished

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL