# 1.1: Introduction

I believe that, when I was a young student, I had some vague naive belief that every equation had as its solution an explicit algebraic formula, and every function to be integrated had a similar explicit analytical function for the answer. It came as quite an eye-opener to me when I began to realize that this was far from the case. There are many mathematical operations for which there is no explicit formula, and yet more for which numerical solutions are either easier, or quicker or more convenient than algebraic solutions. I also remember being impressed as a student with the seemingly endless number of "special functions" whose properties were listed in textbooks and which I feared I would have to memorize and master. Of course, we now have computers, and over the years I have come to realize that it is often easier to generate numerical solutions to problems rather than try to express them in terms of obscure special functions with which few people are honestly familiar. Now, far from believing that every problem has an explicit algebraic solution, I suspect that algebraic solutions to problems may be a minority, and numerical solutions to many problems are the norm.

This chapter is not intended as a comprehensive course in numerical methods. Rather it deals, and only in a rather basic way, with the very common problems of numerical integration and the solution of simple (and not so simple!) equations. Specialist astronomers today can generate most of the planetary tables for themselves; but those who are not so specialized still have a need to look up data in tables such as The Astronomical Almanac, and I have therefore added a brief section on interpolation, which I hope may be useful. While any of these topics could be greatly expanded, this section should be useful for many everyday computational purposes.

I do not deal in this introductory chapter with the huge subject of differential equations. These need a book in themselves. Nevertheless, there is an example I remember from student days that has stuck in my mind ever since. In those days, calculations were done by hand-operated mechanical calculators, one of which I still fondly possess, and speed and efficiency, as well as accuracy, were a prime concern - as indeed they still are today in an era of electronic computers of astonishing speed. The problem was this: Given the differential equation

\begin{equation} \frac{dy}{dx}= \frac{x+y}{x-y} \tag{1.1.1}\label{1.1.1} \end{equation}

with initial conditions \(y = 0\) when \(x = 1\), tabulate \(y\) as a function of \(x\). It happens that the differential equation can readily be solved analytically:

\begin{equation} \ln(x^2 + y^2)= \ 2 \tan^{-1}(y/x) \tag{1.1.2}\label{1.1.2} \end{equation}

Yet it is far quicker and easier to tabulate \(y\) as a function of \(x\) using numerical techniques directly from the original differential equation \(\ref{1.1.1}\) than from its analytical solution \(\ref{1.1.2}\).