## Monte Carlo Pi Estimation

##### 15 Feb 2018

In this post I’ll show how Pi can be computed using a Monte Carlo algorithm in F#. Basically, using the idea of a dartboard we can obtain the value of PI by simply calculating the number of darts that land in the dartboard verses those that land outside it. And by increasing the number of throws we will get closer to PI’s value, for example throwing the dart 1000 times will be closer to PI...Read more...

## Polynomial Value in Haskell

##### 30 Nov 2017

While working on a project that analyze some signals in Haskell I found that I need a simple function polyVal that evaluates a polynomial at specific values. After a failed search for this function ( I thought that I can find a library or an implementation) I decided to write it on my own, anyway, it’s a simple function. So, let’s suppose we have a polynomial p of degree N, this function returns the value:...Read more...

## How to transform a List to a Map in Scala

##### 17 Oct 2017

Yesterday I faced a new, for me at least, problem when I wanted to read a file line by line into a List and transform the result to a Map. Basically, I had a file ( from Rosalind) like the one below, a file in FASTA format. >Tag_XXXX string >Tag_YYYY string >Tag_ZZZZ string A FASTA file contains a labels that starts with ‘>’ character and the associated information on the next line. So it seemed...Read more...