Skip to content

Instantly share code, notes, and snippets.

#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector g(NumericMatrix x) {
double sigma = 0.25;
double S0 = 1;
double Time = 1;
double r = 0;
double K = 1;
@aussetg
aussetg / g.r
Created December 23, 2013 11:38
g <- function(Z) {
prix <- apply(grid,2,cumsum)
prix <- grid
for (i in 1:n) {
prix[i,] <- S0*exp(sigma*prix[i,]+(r-sigma^2/2)*i/n*Time)
}
prix <- colMeans(prix) - K
prix[prix<0] <- 0
return(prix)
}
f <- function(s) {
exp_barre <- mean(exp(-vector_clean/s))
x_barre <- mean(vector_clean)
resul = 1 + log(1/exp_barre) - x_barre/s + 1/exp_barre*mean(exp(-vector_clean/s)*(vector_clean/s-log(1/exp_barre)))
return(resul)
}
uniroot(f,interval=c(10^3, 10^4))
\documentclass{article}\usepackage{graphicx, color}
%% maxwidth is the original width if it is less than linewidth
%% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\makeatletter
\def\maxwidth{ %
\ifdim\Gin@nat@width>\linewidth
\linewidth
\else
\Gin@nat@width
\fi
library(compiler)
enableJIT(3)
pimc = function(n) {
v1 <- runif(n)
v2 <- runif(n)
vc <- v1^2 + v2^2
vc[vc<=1] <- 1
vc[vc>1] <- 0
@aussetg
aussetg / buildapcmice.md
Created August 6, 2012 16:57
/r/buildapc, let's talk gaming mice.

/r/buildapc, let's talk gaming mice.

Original post by h7u9i on reddit.com

I've been on this subreddit for a while, but I haven't seen any good guides to getting a gaming mouse. So here we go.

There's a lot that goes into making a good mouse, and some things may get confusing. Here's list of some terms that you might come across:

  • DPI - Dots per inch - Basically, this describes the sensitivity of your mouse. When you move your mouse, it detects how much you've moved it, and moves the cursor accordingly. The more DPI you have, the less movement is required to move the cursor the same amount.
  • Acceleration - If a mouse has acceleration, it means that as you move the mouse faster, it will move your cursor faster. For example, let's say if I move my move one inch in one second, the cursor will move 500 pixels. With acceleration, if I move my mouse one inch in half a second, the cursor may move 750 pixels. Some people like acceleration, others don't. If your mouse comes with this feature, there is usua