This article considers arrowhead and diagonal-plus-rank-one matrices in Fn×n where F∈{R,C,H} and where H is a noncommutative algebra of quaternions. We provide unified formulas for fast determinants and inverses for considered matrices. The formulas are unified in the sense that the same formula holds in both commutative and noncommutative associative fields or algebras, with noncommutative examples being matrices of quaternions and block matrices. Each formula requires O(n) arithmetic operations, as does multiplication of such matrices with a vector. The formulas are efficiently implemented using the polymorphism or multiple-dispatch feature of the Julia programming language.