Code for my answer on StackOverflow sym.R - main code: simulations & plots funs.R - code for different variants of functions results.R - original results (dputed)