Skip to content

Instantly share code, notes, and snippets.

@Nick3523
Nick3523 / CoronaSimulation.py
Last active April 4, 2020 17:16
Simulation pédagogique de l'évolution de la pandémie
import math
import matplotlib.pyplot as plt
X = 50
X0 = 30
L = 30000
K = 0.5
#X indique le temps, supposons qu'il commence au jour 0 et s'arrête après 50 jours.
#X0 indique le moment où la croissance exponentielle s'arrête, disons après 30 jours.
def calcule(a, b, c) :
return (a+b) *c
a = calcule(1,2,3)
b = calcule ('pommes ', 'et oranges, ', 3)
print(a)
print(b)
# Les entiers et les str n'ont pas de lien entre eux, pourtant la fonction calcule() ne provoque pas d'erreurs
#include <stdio.h>
int pgcd(int a, int b) {
while(b != 0) {
int tmp = b;
b = a % b;
a = tmp;
}
return a;
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
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')
#!/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
#!/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
## Imports & Params
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import linear_model
# On charge le dataset
@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