Consider:
crossRatio[z_, q_, r_, s_] := (z - q) (r - s)/((z - s) (r - q));
points1 = {-1, 1, (-1 + Sqrt[2]) I};
points2 = {I, -I, 1};
ff[z_] :=
w /. Solve[
crossRatio[z, Sequence @@ points1] ==
crossRatio[w, Sequence @@ points2], w][[1]] // Simplify
Now
ff[(-1 + Sqrt[2]) I]
gives me a sequence of errors:
Power::infy: Infinite expression 1/0 encountered. >>
Solve::infc: The system ComplexInfinity==((1/2-I/2) (-I+w))/(-1+w) contains an infinite object ComplexInfinity. >>
ReplaceAll::reps: {ComplexInfinity==((1/2-I/2) (-I+w))/(-1+w)} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>
However, if I leave out the semicolon:
ff[z_] = w /.
Solve[crossRatio[z, Sequence @@ points1] ==
crossRatio[w, Sequence @@ points2], w][[1]] // Simplify
Then it works.
In[262]:= ff[(-1 + Sqrt[2]) I]
Out[262]= (I Sqrt[2] (Sqrt[2]-1)-I (Sqrt[2]-2))/(I Sqrt[2]+I (Sqrt[2]-2) (Sqrt[2]-1))
In[263]:= Simplify[%]
Out[263]= 1
How come? What's the difference between f[z_]:= and f[z_]= ?