Skip to content

Instantly share code, notes, and snippets.

//
// randomWalk.C
////////////////////////////////////////////////////
//
// Simple Monte Carlo
//
///////////////////////////////////////////////////
// Created by @visionlib.postach.io
{
const Int_t kIteration = 1000000;
#!/usr/local/bin/gnuplot
###################################
# #
# @visionlib.postach.io #
# #
###################################
set term post enh color
set output "draft_lottery.eps"
set xlabel "Draft Number"
set ylabel "Day of year"
#Day Month Mo.Number Day_of_year Draft_No.
1 Jan 1 1 305
2 Jan 1 2 159
3 Jan 1 3 251
4 Jan 1 4 215
5 Jan 1 5 101
6 Jan 1 6 224
7 Jan 1 7 306
8 Jan 1 8 199
9 Jan 1 9 194
Apple 70 55 15 11 7 2
Google 70 61 30 3 2 4
Yahoo 63 50 39 2 4 2
Facebook 69 57 34 4 2 3
#!/usr/bin/gnuplot
# Redirect output to file
set terminal postscript enhanced eps color
set output "workforce_male_percent.eps"
set style data histogram
set yrange [0:100]
set key right top title ''
#set title "male workforce percentage"
set style fill solid border -1
@cvson
cvson / simpleProfitPrediction.C
Last active May 6, 2019 08:12
[ Simple profit prediction] to predict profile #ROOT #lifeapp #tutorials
//try to make a toy monte carlo
//waste calculation
void simpleProfitPrediction(){
gBenchmark->Start("htrang");
TH1 *hprofit = new TH1F("hprofit","hprofit",100,-2000,6000);
Int_t numUnit;
Float_t rentUnit=500;
Float_t monthlyExpense;
Float_t profit;
@cvson
cvson / pi_calculation_simple_with_root
Created July 1, 2014 05:22
Pi calculation with simple Monte Carlo (ROOT)
//try to make a toy monte carlo
//pi calculation
void pi(){
TCanvas *c1 = new TCanvas("c1","pi",800,800);
gStyle->SetOptStat(0);
gStyle->SetLineWidth(2);
//c1->SetGrid();
gBenchmark->Start("hpi");
gSystem->Unlink("hpianim.gif"); // delete old file