Skip to content

Instantly share code, notes, and snippets.

@pierre-haessig
pierre-haessig / comparison_partial_sum_formulas.py
Last active November 12, 2021 15:14
Numerical implementation of the formula for the partial sum of a geometric series when ratio equals one. See https://math.stackexchange.com/questions/4288069/formula-for-the-partial-sum-of-a-geometric-series-when-ratio-equals-one
# Comparison of three numerical implementation of the formula for the partial sum of a geometric series
# when ratio equals (or is close to) one.
# See https://math.stackexchange.com/questions/4288069/formula-for-the-partial-sum-of-a-geometric-series-when-ratio-equals-one
from math import expm1, log1p
def SN_def(a,N):
return sum(a**n for n in range(N))
def SN_form(a,N):
@pierre-haessig
pierre-haessig / Optim NLopt combined objective constraints - final example.ipynb
Created July 19, 2021 12:11
NLopt+ForwardDiff single call to simulator (using caching and DiffResults)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pierre-haessig
pierre-haessig / Marp_ecosystem_map.drawio
Last active July 19, 2021 10:25
Marp tools concept maps
<mxfile host="Electron" modified="2021-07-19T10:24:03.119Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/14.6.13 Chrome/89.0.4389.128 Electron/12.0.7 Safari/537.36" etag="CDG5akxwugxlUMQvqCN3" version="14.6.13" type="device"><diagram id="Ig-QWzCFrPFKFMDAhXfC" name="Page-1">7Vxbd6M2EP41nNM+2AeEDfZjNol3t03a9GS33fZNBmFrA4gKObb311cSEubmmMT4sl3nIYZBGoTmm/kGjWzDvo5W7ylM5vfER6EBTH9l2DcGAJbj2vxDSNZKMh64mWRGsa9kG8Ej/oaU0FTSBfZRWmrICAkZTspCj8Qx8lhJBikly3KzgITluyZwhmqCRw+Gdelf2GdzJbWc8ebCB4Rnc3XrEVDPF0HdWD1JOoc+WRZE9q1hX1NCWHYUra5RKGZPz0vWb7Llaj4wimLWpsNyGU/Wd+k/nz892uDL6Btc9YKerezzDMOFemI1WrbWU4B8PiPqlFA2JzMSw/B2I31HySL2kbiPyc82be4ISbjQ4sKviLG1Mi9cMMJFcxaF6mpAYjaBEQ4FTD7GDFElfCQL6ok+c8a4xcHQvuL/+DOKf6JB2p8RMgsRTHDa90gkL3ipbDoJMpX8MFdanzU1kam+07ap0uiDdIbYS1OatROzVriBssl7RCLEKB+TSVEIGX4u4wwquM7ydhuL8gNl1NcYeFgzsI8CHHOfarLzHZxyDy7ZBoZ4FvNjD6kpfEaUYe4hV+pChH0/gwFK8Tc4lfoEEBKCuYGE8uE7Y3izzc51k7wMVX57tDIanF/duuRfpSlXvXpm33KtQdZXBSYF+9ZGUcofxCMWNIOS0kp/EgQph07VpPkAm6z8OUX09+lXEdqAGWbWybzUCZkwF
@pierre-haessig
pierre-haessig / JuMP modify constraint.ipynb
Created May 25, 2018 16:09
Experiment with the ability to modify a constraint of an existing optimization problem modeled with JuMP
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pierre-haessig
pierre-haessig / Diamonds Altair.ipynb
Created October 24, 2016 16:06
first test of Altair viz package on the diamonds dataset
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pierre-haessig
pierre-haessig / Marker disappear bug.ipynb
Created May 26, 2016 11:28
Matplotlib markers disappear bug when using seaborn-notebook style (mpl 1.5.1)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pierre-haessig
pierre-haessig / logit_norm_imshow.ipynb
Created July 13, 2015 15:42
Image plot with a logit scale -- example of a transition matrix
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pierre-haessig
pierre-haessig / luminosity_2_channels.ino
Created May 21, 2015 12:04
2 channels light sensor (Broadband+IR) based on Arduino board + TSL2561 sensor
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_TSL2561_U.h>
Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);
void displaySensorDetails(void)
{
sensor_t sensor;
tsl.getSensor(&sensor);
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pierre-haessig
pierre-haessig / config
Last active April 3, 2020 00:36
Raspberry Pi kernel config: comparing Raspbian's 3.12-1-rpi vs. RPi foundation's 3.12.32+ (e.g. config of 1-Wire bus)
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 3.12.32 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y