Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Calculate portfolio variance given asset covariance matrix and weights.
let covMatrix = [[0.0004;0.0002];[0.0002;0.0003]]
let weights = [0.6;0.4]
let portfolioVariance =
List.mapi (fun i row -> List.mapi (fun j x -> x * weights.[i] * weights.[j]) row |> List.sum) covMatrix |> List.sum
printfn "Portfolio Variance: %f" portfolioVarianceF# is a functional-first programming language on the .NET platform, widely used in finance for quantitative modeling, risk analysis, and algorithmic trading due to its strong type system, immutability, and functional programming paradigms.
Origin & Creator
Developed by Microsoft Research in 2005, evolving from OCaml to provide functional-first programming on .NET for both academic and industry applications.
Industrial Note
Extensively used in investment banks, hedge funds, and fintech for quantitative analytics, derivatives pricing, portfolio optimization, and real-time risk management.