complex with imaginary part 0 must be a real

Even if it is the result of some function
more tests converted to doctests
permissive treatment of scalars in replicate (/)