Skip to content

Instantly share code, notes, and snippets.

@Nick3523
Nick3523 / Needle.py
Created January 2, 2020 14:38
Buffon's Needle Problem
'''
n = nombre de fois où l'aiguille est lancée
nbEssais = nombre de fois où l'expérience est répetée
a = longueur de l'aiguille
b = distance entre 2 lattes
theta = l'angle formée par l'aiguille et la latte
xcenter = les cordonnées x de l'aiguille sur le sol
On limite les valeurs theta et du centre comme suit :
import numpy as np
import math
### Parameters ###
sigma = 0.3
T = 200
dt = 1/2000
q = 0. #dividendes rate
Le modèle Black-Scholes ou modèle Black-Scholes-Merton qui est un modèle mathématique du marché pour une action,
dans lequel le prix de l'action est un processus stochastique en temps continu; par opposition au
"modèle Cox Ross-Rubinstein" qui suit un processus stochastique en temps discret.
########################################
Les inputs :
S: spot price
K: strike price
T: time to maturity
@Nick3523
Nick3523 / CRR Pricer.py
Last active January 2, 2020 14:48
Implémentation du Modèle binomial pour pricer les options européennes.
import numpy as np
import math as m
### Les différents input ###
S = 100
k = 100
r = .05 #le taux sans risque
v = .3
T = 20/36
## Imports & Params
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import linear_model
# On charge le dataset
#!/usr/bin/env python
# coding: utf-8
# Code partiel, l'originial étant fait sur Jupyter
## Imports & Param's
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import fetch_openml
from sklearn.model_selection import train_test_split
from sklearn import neighbors
#!/usr/bin/env python
# coding: utf-8
# # Imports & Params
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import linear_model
import seaborn as sns
from sklearn.model_selection import train_test_split
import yagmail
import random
from datetime import datetime
yag = yagmail.SMTP("email_envoyeur@gmail.com","mot_de_passe")
quote = ""
date = datetime.today().strftime('%d-%m-%Y')
Function my_convert(ch As String) As String
Dim dict As New Scripting.Dictionary 'Nécessite d'importer Microsoft Scripting Runtime
dict.Add Key:="A", Item:=10
dict.Add Key:="B", Item:=11
dict.Add Key:="C", Item:=12
dict.Add Key:="D", Item:=13
dict.Add Key:="E", Item:=14
dict.Add Key:="F", Item:=15
#include <stdio.h>
int pgcd(int a, int b) {
while(b != 0) {
int tmp = b;
b = a % b;
a = tmp;
}
return a;