Inverse source problems for elliptic and parabolic equations