For the square well, you can define a piece-wise continuous function such as:

V(x) = V1, for x≤ 0; 0 for 0≤x≤L; V2 for x> L

For Hydrogen the potential energy is:

V(x) = — 1/x²

Note that you run into issues when x = 0 as the potential energy diverges. You you only solve in the region 0 < x < Infinity with the assumption that

R (x) = 0 when x = 0 [in principle, you have to solve for the radial wavefunction which is given by R(x) = x psi(x) ]