Skip to content

Instantly share code, notes, and snippets.

View thierrymoudiki's full-sized avatar

Thierry Moudiki thierrymoudiki

View GitHub Profile
@thierrymoudiki
thierrymoudiki / Ruby with chruby
Created August 22, 2023 01:33 — forked from rubyandcoffee/Ruby with chruby
chruby - Installing and managing Ruby versions
To install chruby and ruby-install:
brew install chruby ruby-install
To install Ruby using ruby-install:
ruby-install ruby 2.7.1
NOTE: You can find latest stable version of Ruby here: https://www.ruby-lang.org/en/downloads/
If you have issues installing Ruby then try the following:
brew install openssl@3
ruby-install 3.2.2 -- --with-openssl-dir=$(brew --prefix openssl@3)
@thierrymoudiki
thierrymoudiki / SmithWilson.R
Last active August 29, 2015 14:21
Annuity value with UFR method
# Wilson function
fonctionsWilson <- function(t,u,alpha,UFR)
{
N <- length(u)
J <- length(t)
u_mat <- matrix(rep.int(u,J), nrow=J, byrow=T)
t_mat <- t(matrix(rep.int(t,N), nrow=N, byrow=T))
min_u <- u_mat*(u_mat<=t_mat) + t_mat*(u_mat>t_mat)
max_u <- u_mat + t_mat - min_u
return(exp(-UFR*(u_mat+t_mat))*(alpha*min_u - 0.5*exp(-alpha*max_u)*(exp(alpha*min_u)-exp(-alpha*min_u))))