Finding Optimal Weight Vectors for Ridge Function Approximation in \(\boldsymbol{L}^{\boldsymbol{2}}\boldsymbol{(D)}\)