imfilter and arrays

By: Michele Pratusevich

Re-posted from:

Whereas in my last post I manually wrote a blur kernel and code to convolve an image, I didn’t want to do that every time an image convolution came up. So in this post I learned about the imfilter function from the ImageFiltering.jl package. I also learned about the @time macro and had a small aside on array creation.

Continue reading

Flipping coins in continuous time: The Poisson process

By: Júlio Hoffimann

Re-posted from:

In this post, I would like to contrast two ways of thinking about a coin flip process—one of which is very intuitive and one of which can be very useful for certain applications. This insight is inspired on a stochastic modeling class by Ramesh Johari.

Discrete-time coin flip process

Suppose that I ask you to simulate a sequence of i.i.d. (independent and identically distributed) coin flips in a computer where the probability of flipping a coin and observing a head () is and the probability of flipping a coin and observing a tail () is :

, , , , , , ,

There are at least two ways of doing this:

The most popular solution by far is to go to your favorite programming language (e.g. Julia :blush:) and sample a sequence of :

using Distributions

p = .5  # probability of head
N = 100 # number of coin flips

coin_flips = rand(Bernoulli(p), N)
# 1, 0, 0, 0, 1, 1, ...

Think of a head (or ) as a successful coin flip. For example, you earn $1 whenever the head comes up and nothing otherwise. Keep track of the times when you had a successful outcome

Now is the trick. In a coin flip process, the interarrival times between successes are i.i.d. . Instead of simulating the coin flips directly, simulate the times at which a head will occur:

using Distributions

p = .5 # probability of head
N = 100 # number of coin flips

T = rand(Geometric(p), N)
head_times = cumsum(T+1)

# construct process in a single shot
coin_flips = zeros(N)
head_times = head_times[head_times  N]
coin_flips[head_times] = 1
# 1, 0, 1, 1, 0, 0, ...

Why is solution B relevant?

In other words, why would you care about a solution that is more verbose and somewhat less intuitive?

Imagine that the probability of success is extremely low. Would you like your computer spending hours generating tails (or ) before it can generate a head? For some applications, this is a critical question.

More than that, sometimes Solution A is not available…

Continuous-time coin flip process

The Poisson process is the equivalent of the coin flip process in continuous-time. Imagine that you divide real time (a real number) into small intervals of equal lenght :

If a coin is to be flipped at each of these marks in the limit when , then Solution A is not available! There are uncountably many coin flips in the interval .

However, simulating this process in a computer is possible with Solution B. For a Poisson process with success rate , the interarrival times are i.i.d. .

Julia in Finance Seminar in London on the 16th of March

By: Julia Computing, Inc.

Re-posted from:

Julia Computing invites to the Julia in Finance Seminar in London on the 16th of March, organised in association with the CQF Institute. This event will introduce you to Julia, the easy-to-learn high-performance mathematical programming language that is taking the finance industry by storm.

The Julia in Finance Seminar takes place on Thursday, March 16th from 6:00 PM to 9 PM followed by refreshments and networking. The venue for this event is the Fitch Learning, The Corn Exchange, 55 Mark Lane, London, EC3R 7NE.

Come find out how quants, traders and data scientists from hedge funds, investment banks, and across financial services industry worldwide are using Julia to gain a mathematical computing advantage over their competitors by processing more data up to 1,000x faster than before. See how Julia enables innovation in the fintech and regtech sectors, helping companies and regulators keep ahead of a fast changing market.

There will be product demos, benchmarks, customer stories and use cases in Finance and Insurance, especially around trading, risk analytics and asset management among others.


Topic Speaker Time
Registration & Welcome   6:00 PM
Julia Computing – Company overview, vision and products Dr. Viral Shah, CEO, Julia Computing and Co-Creator of Julia language 6:10 PM
Large Scale Capital Allocation Models with Julia Tim Thornham, Financial Modeling Solutions Director, Aviva 6:30 PM
Demo of JuliaRun – Limitless Scalability Avik Sengupta, VP Engineering, Julia Computing 6:50 PM
Demo of JuliaFin – Time Series Analytics & Financial Contracts Made Easy Simon Byrne, Core Developer, Julia Computing 7:10 PM
Julia powered foreign exchange trading analytics at BestX Pete Eggleston, Co-Founder & Director, and Matt Hardcastle, Senior Architect, BestX Ltd 7:30 PM
Closing Remarks, refreshments and networking   7:50 PM

The event is free to attend in person, and will also be live-streamed worldwide. Please register below to reserve your seat.

About Julia

Julia is the simplest, fastest and most powerful numerical computing language available today. Julia combines the functionality of quantitative environments such as Python and R, with the speed of production programming languages like Java and C++ to solve big data and analytics problems. Julia delivers dramatic improvements in simplicity, speed, capacity, and productivity for data scientists, algorithmic traders, quants, scientists, and engineers who need to solve massive computational problems quickly and accurately.

Julia offers an unbeatable combination of simplicity and productivity with speed that is thousands of times faster than other mathematical, scientific and statistical computing languages.

Partners and users include: Intel, The Federal Reserve Bank of New York, Lincoln Laboratory (MIT), The Moore Foundation and a number of private sector finance and industry leaders, including several of the world’s leading hedge funds, investment banks, asset managers and insurers.

About Julia Computing, Inc.

Julia Computing, Inc. was founded in 2015 to develop products around Julia such as JuliaFin. These products help financial firms leverage the 1,000x improvement in speed and productivity that Julia provides for trading, risk analytics, asset management, macroeconomic modeling and other areas. Products of Julia Computing make Julia easy to develop, easy to deploy and easy to scale.

About CQF Institute

Part of Fitch Learning, the CQF Institute is the awarding body for the Certificate in Quantitative Finance and provides a platform for educating and building the quantitative finance community around the globe. Promoting the highest standard in practical financial engineering, the Institute offers its members exclusive access to educational content featured on the Institute website, keeping its members up to date on the latest quant finance industry practices.