Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
########################################
## PYTHON
########################################
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site


########################################
## JETBRAINS / PYCHARM
########################################

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/
cmake-build-release/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

14 changes: 10 additions & 4 deletions SABR - Small Time Mass.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"outputs": [],
"source": [
"import numpy as np\n",
"from scipy.special import gamma, gammainc, hyp1f1\n",
"from scipy.special import gamma, gammaincc, hyp1f1\n",
"from scipy.integrate import quad\n",
"from scipy.optimize import bisect\n",
"import pandas as pd\n",
Expand Down Expand Up @@ -112,7 +112,13 @@
"###Computes the function m by direct integration (quadrature)###\n",
"################################################################\n",
"def integrand_m(y, z, u):\n",
" temp = np.exp(-z*np.cosh(2.*u))*hyp1f1(0.75, 1.5, 2.*z*np.sinh(u)*np.sinh(u))*np.sin(np.pi*u/y)\n",
" # Instead of the original express,\n",
" # temp = np.exp(-z*np.cosh(2.*u))*hyp1f1(0.75, 1.5, 2.*z*np.sinh(u)*np.sinh(u))*np.sin(np.pi*u/y)\n",
" # we can simplify the expression using \n",
" # Kummer's transformation, M(a,b,z) = e^z M(b-a,b,-z) and cosh(2x) = 1 + 2*sinh(x)^2\n",
" # This new expression also gets around the problem of M(*,*,z) -> infty for large z\n",
" \n",
" temp = np.exp(-z)*hyp1f1(0.75, 1.5, z*(1.-np.cosh(2*u)))*np.sin(np.pi*u/y)\n",
" return np.exp(-u*u/y)*temp*np.sinh(2.*u)\n",
"\n",
"def m(y, z):\n",
Expand All @@ -132,7 +138,7 @@
"def ppX(r, beta, x0):\n",
" ## mass at zero in the CEV model\n",
" b1 = 1.-beta\n",
" return 1. - gammainc(0.5/b1, 0.5*x0**(2.*b1)/(r*b1*b1))\n",
" return gammaincc(0.5/b1, 0.5*x0**(2.*b1)/(r*b1*b1))\n",
"################################################################\n",
"################################################################"
]
Expand Down Expand Up @@ -466,7 +472,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.7.3"
},
"zanadu": {
"authors": [
Expand Down