I recently posted the following information in the talk page of the Wikipedia article on functions, where they were arguing about whether "function" means a set of ordered pairs with the functional property or a structure with a domain $D$, a codomain $C$, and a graph $G$ which is a subset of $D\times C$ with the functional property.

I collected data from some math books published since 2000 that contain a definition of function; they are listed below. In this list, "typed" means function was defined as going from a set A to a set B, A was called the domain, and B was not given a name. If "typed" is followed by a word (codomain, range or target) that was the name given the codomain. One book defined a function essentially as a partial function. Some that did not name the codomain defined "range" in the sense of image. Some of them emphasized that the range/image need not be the same as the codomain.

As far as I know, none of these books said that if two functions had the same domain and the same graph but different codomains they had to be different functions. But I didn't read any of them extensively.

My impression is that modern mathematical writing at least at college level does distinguish the domain, codomain, and image/range of a function, not always providing a word to refer to the codomain.

If the page number as a question mark after it that means I got the biblio data for the book from Amazon and the page number from Google books, which doesn't give the edition number, so it might be different.

I did not look for books by logicians or computing scientists. My experience is that logicians tend to use partial functions and modern computing scientists generally require the codomain to be specified.

Opinion: If you don't distinguish functions as different if they have different codomains, you lose some basic intuition (a function is a map) and you mess up common terminology. For example the only function from {1} to {1} is the identity function, and is surjective. The function from {1} to the set of real numbers (which is a point on the real line) is not the identity function and is not surjective.

THE LIST

Mathematics for Secondary School Teachers

By Elizabeth G. Bremigan, Ralph J. Bremigan, John D. Lorch, MAA 2011

p. 6 (typed)

Oxford Concise Dictionary of Mathematics, ed. Christopher Clapham and James Nicholson, Oxford University Press, 4th ed., 2009.

p. 184, (typed, codomain)

Math and Math-in-school: Changes in the Treatment of the Function Concept in …

By Kyle M. Cochran, Proquest, 2011

p74 (partial function)

Discrete Mathematics: An Introduction to Mathematical Reasoning

By Susanna S. Epp, 4th edition, Cengage Learning, 2010

p. 294? (typed, co-domain)

Teaching Mathematics in Grades 6 – 12: Developing Research-Based …

By Randall E. Groth, SAGE, 2011

p236 (typed, codomain)

Essentials of Mathematics, by Margie Hale, MAA, 2003.

p. 38 (typed, target).

Elements of Advanced Mathematics

By Steven G. Krantz, 3rd ed., Chapman and Hall, 2012

p79? (typed, range)

Bridge to Abstract Mathematics

By Ralph W. Oberste-Vorth, Aristides Mouzakitis, Bonita A. Lawrence, MAA 2012

p76 (typed, codomain)

The Road to Reality by Roger Penrose, Knopf, 2005.

p. 104 (typed, target)

Precalculus: Mathematics for Calculus

By James Stewart, Lothar Redlin, Saleem Watson, Cengage, 2011

p. 143. (typed)

The Mathematics that Every Secondary School Math Teacher Needs to Know

By Alan Sultan, Alice F. Artzt , Routledge, 2010.

p.400 (typed)