Numerical and optimal control methods for partial differential equations arising in computational finance