Linear algebra and numerical algorithms using dual numbers