tirthajyoti / stats-maths-with-python Goto Github PK
View Code? Open in Web Editor NEWGeneral statistics, mathematical programming, and numerical/scientific computing scripts and notebooks in Python
License: MIT License
General statistics, mathematical programming, and numerical/scientific computing scripts and notebooks in Python
License: MIT License
Thought it may be helpful/convenient to have a link to the license in the readme
I came across this repo as i try to understand in detail how the generation of sampels from a Brownian motion works with python.
A question arised as i took a look into the Brownian-motion-with-Python.ipynb Notebook. The gen_normal() method defined in the Brownian class is there defined as follows:
def gen_normal(self,n_step=100):
"""
Generate motion by drawing from the Normal distribution
Arguments:
n_step: Number of steps
Returns:
A NumPy array with `n_steps` points
"""
if n_step < 30:
print("WARNING! The number of steps is small. It may not generate a good stochastic process sequence!")
w = np.ones(n_step)*self.x0
for i in range(1,n_step):
# Sampling from the Normal distribution
yi = np.random.normal()
# Weiner process
w[i] = w[i-1]+(yi/np.sqrt(n_step))
return w
Why are we scaling the sampels from the normal distribution yi
by the factor 1/np.sqrt(n_step)
? I am wondering, since in other exampels that show the sampling from a geometric brownian motion the increments of the wiener process are defined by np.random.normal(0, np.sqrt(dt), size=(len(sigma), n)).T
and thus the scaling is refering to the increment of the time step (see the example given in Wikipedia ). In this code it appears that the scaling is defined by the total number of time steps.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.