function [x,w]=scale_formula(x,w,a,b)
% INPUT:
% x,w: nodes and weights of Gauss-Legendre rule,
% a,b: integration extrema
% OUTPUT:
% x,w: nodes and weights of the Gauss-Legendre formula in [a,b].

 x=((a+b)/2)+((b-a)/2)*x; % scale nodes [a,b].
 w=((b-a)/2)*w; % scale weights in [a,b].
