Skip to content

Instantly share code, notes, and snippets.

@O-I
O-I / univariate_polynomial_roots.rb
Last active July 31, 2019 22:26
Ruby univariate polynomial root finder
require 'matrix'
# Input: an array of the n coefficients [a_n, a_n-1,..., a_1] of
# a univariate polynomial p of degree n ([a_n]x^n + [a_n-1]x^n-1 + ... + a_1)
#
# Output: an array of all n roots of p
#
# Exploits the fact that the eigenvalues of the companion matrix of the
# monic equivalent of p are the roots of p
#
@O-I
O-I / all_about_nil.md
Last active August 29, 2015 13:57
Master of nil
@O-I
O-I / README.md
Last active December 25, 2015 22:19
Ruby Quicksort
@O-I
O-I / get_character.rb
Last active November 28, 2018 18:01
Ruby Character to Unicode Converter
def get_character(hexnum)
char = ''
char << hexnum.to_i(16)
end