There is no one function: i.e. there are several possible.
Here is one that I have used with classes.
Name points: [imath]A:(1,1),~B:(2,1),~M:(1,0)~\&~N:(1000,0)[/imath]
Now the intervals [imath][1,2]~\&~[1,10^3][/imath] can be represented the line segments [imath]\overline{AB}~\&~\overline{MN}~[/imath].
The slope of the line [imath]\ell:\overleftrightarrow {NB}[/imath] is [imath]\dfrac{-1}{998}[/imath]. Consider the point [imath]\{P\}=\overleftrightarrow {AM}\cap\overleftrightarrow {NB}[/imath]
Take any point [imath]T\in\overline{AB}[/imath] and form [imath]\overleftrightarrow {PT}[/imath] That line must intersect [imath]\overline {MN}[/imath] in a unique point.
Do the same with [imath]S\in\overline{MN}[/imath] and form [imath]\overleftrightarrow {PS}[/imath] That line must intersect [imath]\overline {AB}[/imath] in a unique point.
Therefore we have a one-to-one correspondence between [imath]\overline{AB}~\&~\overline {MN}[/imath].
[imath][/imath][imath][/imath][imath][/imath]