Skip to content

Instantly share code, notes, and snippets.

View DMechPickingDemo.d
import std.stdio;
import std.algorithm;
import dmech.geometry;
import dmech.rigidbody;
import dmech.world;
import dmech.shape;
import dmech.raycast;
import dlib.core.memory;
import dlib.math.vector;
@taumuon
taumuon / BulletPickingDemo.cpp
Created Feb 20, 2018
Simple application trying out ray picking in Bullet C++ Physics Engine
View BulletPickingDemo.cpp
#include "btBulletDynamicsCommon.h"
#include <map>
#include <memory>
int main()
{
btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
@taumuon
taumuon / module5.py
Created Dec 17, 2015
Lid driven cavity flow in python
View module5.py
import numpy
from matplotlib import pyplot
from matplotlib import rcParams
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from math import pi
rcParams['font.family'] = 'serif'
@taumuon
taumuon / SIMD Vectorisation in .NET
Created Oct 1, 2014
SIMD Vectorisation in .NET
View SIMD Vectorisation in .NET
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
namespace Burgers
{
@taumuon
taumuon / MonteCarloCppAmp
Last active Jan 16, 2016
Monte Carlo double barrier option pricing using C++ AMP
View MonteCarloCppAmp
#define NOMINMAX
#include <amp.h>
#include <iostream>
#include <chrono>
#include <tuple>
#include <random>
#include <algorithm>
#include <numeric>
@taumuon
taumuon / MonteCarloExoticOptionsC++
Last active Aug 29, 2015
Monte Carlo pricing of Exotic Options in Functional style C++
View MonteCarloExoticOptionsC++
#include "stdafx.h"
#include <iostream>
#include <chrono>
#include <tuple>
#include <random>
#include <algorithm>
#include <numeric>
#include <functional>
@taumuon
taumuon / MonteCarloExoticOptions
Created Apr 25, 2014
Monte Carlo pricing of Exotic Options in F#
View MonteCarloExoticOptions
open MathNet.Numerics.Distributions
open MathNet.Numerics.Statistics
let callPayoff strike price = max (price - strike) 0.0
let europeanPayoff payoff assetPath = assetPath |> Seq.last |> payoff
let europeanCallPayoff strike assetPath = assetPath |> europeanPayoff (callPayoff strike)
let asianArithmeticMeanCallPayoff strike (assetPath:seq<float>) = assetPath.Mean() |> callPayoff strike
@taumuon
taumuon / MonteCarloFinanceWeek1
Created Jan 24, 2014
Implementation of part of the week 1 demo code of Iversity's Monte Carlo Methods in Finance, in F# using Deedle
View MonteCarloFinanceWeek1
// This code is based on matlab code provided through the course "Monte Carlo Methods in Finance".
// https://iversity.org/my/courses/monte-carlo-methods-in-finance/
// and Olaf Smits's Python conversion
// http://nbviewer.ipython.org/github/olafSmits/MonteCarloMethodsInFinance/blob/master/Week%201.ipynb?create=1
open System
open Deedle
open FSharp.Charting
let readFrame (stock:string) =
@taumuon
taumuon / Option Pricing Explicit Finite Difference F#
Last active Mar 2, 2016
Option Pricing using Explicit Finite Difference Method, converted to F# from VBA code in Paul Wilmott Introduces Quantitative Finance book. http://taumuon-jabuka.blogspot.co.uk/2013/02/option-pricing-in-f-using-explicit.html
View Option Pricing Explicit Finite Difference F#
open System
let callPayoff strike spot = max (spot - strike) 0.0
let putPayoff strike spot = max (strike - spot) 0.0
let triplewise (source: seq<_>) =
source
|> Seq.windowed 3
|> Seq.map (fun triple -> (triple.[0], triple.[1], triple.[2]))
You can’t perform that action at this time.