Skip to content

Instantly share code, notes, and snippets.

View anriseth's full-sized avatar

Asbjørn Nilsen Riseth anriseth

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anriseth
anriseth / opmerror
Created March 14, 2017 16:51
opm-material cmake error
Script started on Tue 14 Mar 2017 16:49:45 GMT
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
mkdir /scratch/brosa
cd /scratch/brosa
git clone git://github.com/JuliaLang/julia.git
cd julia
git checkout release-0.5
make -j 2
mkdir $HOME/bin
ln -s julia $HOME/bin
# Run julia
$HOME/bin/julia
@anriseth
anriseth / atomsetup.sh
Last active March 15, 2023 05:58
Install Atom from source
# Ask admin to install the following packages:
# build-essential git libsecret-1-dev fakeroot rpm libx11-dev libxkbfile-dev libgnome-keyring-dev
# When that is done, you can install everything else locally
# Install Node.js
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
source $HOME/.bashrc
nvm install v6.10.3
nvm use v6.10.3
@anriseth
anriseth / pricing.jl
Created May 25, 2017 00:11
Optim example: HJB equation
using Interpolations, Optim
using LaTeXStrings, Plots
function brownsim(T,γ,C,x,amin,amax,Varr,polarr)
# Dynamics
# dS_t = -Q(a) dt + σQ(a) dW_t, stopped at zero
# Solve
# max \int_0^T aQ(a) dt - CS_T
#
@anriseth
anriseth / pricing.tex
Created May 25, 2017 00:59
Optim example: HJB equation TeX
\documentclass{article}
\usepackage{amssymb,amsmath}
\usepackage{filecontents}
\usepackage{url}
\DeclareMathOperator*{\argmax}{arg\,max}
\author{Asbj{\o}rn Nilsen Riseth}
\date{\today}
\title{Optim example: Solve HJB equation}
@anriseth
anriseth / pdedescription.md
Last active June 20, 2017 09:53
Nonlinear PDE

Hi, I'm trying to solve a nonlinear PDE that looks similar to a time-dependent eikonal equation. Can anyone provide me some advise for the best Julia-ecosystem approach to solving it, please?

I'm trying to find $$v:[0,1]\times \mathbb R_{\geq 0}^2$$, such that $$ v_t - \frac{\sigma^2}{2} g^2 v_{gg} - gq_2{\left(\frac{\frac{q_1}{q_2}-v_s}{2}\right)}^2 = 0 $$

With boundary conditions

  • $$ v(t,s,g) = -Cs $$ on $${t=0}$$ or $${s=0}$$ or $${g=0}$$.
  • $$v_g(t,s,\infty) = 0 $$
  • $$v_s(t,\infty,g) = -C $$
@anriseth
anriseth / calculus.txt
Created January 23, 2018 09:33
DiffEqTools Calculus comparison
julia> include("test/runtests.jl")
./general/objective_types.jl
2.170476 seconds (641.11 k allocations: 34.523 MiB, 0.86% gc time)
Test Summary: | Pass Total
general | 21 21
./multivariate/fdtime.jl
#####################
Solver: L-BFGS
Problem: Rosenbrock
f-calls: 77
@anriseth
anriseth / norwegian_dvorak.ahk
Created October 10, 2018 08:39
Autohotkey (AHK) Norwegian Dvorak setup from UK keyboard
;-- README ---------------------------------------------------------------------
; This AHK file re-maps a Qwerty keyboard into a Dvorak keyboard. This is especially useful when
; the local computer is limited by corporate security policies to disallow installation of custom
; software. AHK can be run as a portable app, and this script then remaps the existing keyboard.
;
; Original script by: ----------------------------------------------------------
; Torben Gundtofte-Bruun, torben@g-b.dk, http://torben.g-b.dk/+
;
; Amended for UK keyboard by by: -----------------------------------------------
; Asbjørn Nilsen Riseth
@anriseth
anriseth / uk_daily_covid_deaths_region.py
Last active November 23, 2020 09:51
Daily UK covid deaths by region
import pandas as pd
import matplotlib.pyplot as plt
plt.ion()
file_url = 'https://data.london.gov.uk/download/coronavirus--covid-19--deaths/516cc869-179d-4cc7-84a4-2cf2fa2d112f/nhse_daily_announced_deaths_by_region.csv'
df = pd.read_csv(file_url, index_col=[0, 1], parse_dates=[1])
df_grouped = df.groupby(['nhs_england_region', 'date_of_death']).sum()['new_deaths_total'].unstack(0)
df_grouped.ewm(alpha=1/3).mean().plot()