This is a quotation from Neugebauer (1969): "The common belief that we gain "historical perspective" with increasing distance seems to me utterly to misrepresent the actual situation. What we gain is merely confidence in generalisations which we would never dare make if we had access to the real wealth of contemporary evidence." (Preface vi).
This warning goes for the study of all history, but particularly the history of past science. So much has been lost of all the material that was written, we can never really be sure of any claim for the first appearance or the 'invention' of an idea. The more that has recently been studied, the less we can rely on former claims that, for example, 'Hipparchus invented trigonometry'. What he did, we now know, was to modify a technique known to both Egyptian and Babylonian scholars, using the data that had been passed on to him, and in this respect, he was an important link in a chain. It depends what you mean by 'invented' and 'trigonometry'. Not until the Arabs used the Indian idea of 'sine' and then developed the Greek and earlier techniques to apply them to map making, geography, land measurement, and other sciences does 'trigonometry' become a separately established part of mathematics.
The earliest conceptions.
Early man was aware of the rotation of the heavens and that this was a recurrent phenomenon. Circular movement and repeated events like the seasons, and natural changes like the flooding of rivers, began to be linked to events in the sky. Further observation led to the recognition of patterns in the stars and the regular phases of the moon. The motion of the moon, set against the patterns of the stars, led to the conception that different sections of the sky were visible at different times of the year. This led to the idea that the heavens could be split up into sections (decans of 10 degrees each in Egypt, and in Mesopotamia, sections of 30 degrees for the zodiacal regions).
Thus rotation in a circle, and division of the rotation into sections was the foundation for the idea of angle.
How often do children look at the stars? Are they aware of the rotation of the heavens? There is so much light pollution in our towns and cities that it is difficult to see anything up there! For ancient people, with no street lighting, events near the horizon (like the first appearance of the new crescent Moon) were visible and became important in establishing a calendar.Does your school have a telescope? Even with a modest one, you can see a lot. Where is your nearest planetarium? These can often be found at, or borrowed from, your regional Science Centre.
Measuring Heights and Distances.
The Merkhet was used for measuring both horizontally and vertically. Simple measures of heights and distances were used to locate objects in the sky. From the practical measurement of a height and a horizontal distance, we get the tangent ratio, and from the measurement of the half-chord and the radius of the circle we obtain the sine ratio.
The geometrical idea of ratio, the comparison of two like quantities, was formally stated in Euclid Book V (Definitions 3, and 5,) and then extended to proportion, which is the equivalence of ratios (Definition 6).
Note that our use of the word proportion has two senses. In the expression "A is proportional to B" or "A and B are in proportion" we are comparing two ratios in the Euclidean sense, whereas "X is a proportion of Y" refers to a part-whole relationship.
Comparing ratios of quantities lies at the heart of many practical situations. If the entities in the ratio are different then there are many kinds of mixed ratios, miles/hour (mph), metres/second (mps), pounds per square inch (lbs/inch$^2$) and so on. Also we find many concepts in Physics like density (mass/unit volume, or m/cm$^3$), the ampere (electric charge flowing per second dQ/dt), the Galileo (metres per second$^2$ or m/s$^2$) all measured in mixed ratios.
Once we have the possibility of comparing ratios of unlike magnitudes (objects, substances, etc.) we are in a very powerful position.
Provided we can establish a relationship of equality between pairs of ratios of unlike things, the possibility for scientific experiment and explanation is open.
Functions.
If we are able to establish a direct relationship between two quantities so that naming one quantity precisely identifies another, (and vice versa) then we call this a function. We say that 'y is a function of x' and use various symbols to show this. The precise definition of function involves a very sophisticated collection of concepts, and even the 'loose' use of the word (like the familiar 'function machine') involves ideas that have developed over many years. In fact, our modern definition of function did not appear until the middle of the 20th century!
There is no evidence that ancient people thought of any relationships between numbers, geometrical quantities or events in this way. They certainly recognised and used relationships in their reasoning, they realised that some relationships were regularly repeated, but to attribute the idea of a function to them is quite wrong.