<< Graphics`Graphics`
<< Graphics`Graphics3D`
<< NumericalMath`NIntegrateInterpolatingFunct`

Off[NIntegrate::"slwcon"]

hc = 197.327053;
hc2 = (hc/1000. )^2 ;
mN = (938.27231 + 939.56563)/2.  ;

      
eB = -7.72;

colors = {{}, Hue[1], Hue[0.3]};

intops = {PrecisionGoal -> 4,  MinRecursion -> 5,  
          MaxRecursion -> 30};

SetDirectory["e:/ser/phys/spin/code/NucleonInput"]

Reading (x, (Q^2)) grid

Reading (W, (Q^2)) grid

nq = 19;
nw = 201;
wqdat = OpenRead["Ggrid.g1p"];
wg1grid = {};
qgrid = ReadList[wqdat, Number, nq];
wgrid = ReadList[wqdat, Number, nw];
Do[
Do[
          v = Read[wqdat, Number]; 
w = wgrid[[j]]; 
          q = qgrid[[k]]; 
          AppendTo[wg1grid, {w, q, v}]
, {j, 1, 
            nw}]
, {k, 1, 
          nq}];
Close[wqdat];

Interpolation

Clear[x, w, 
        q2];
  
wg1[w_, 
          q2_] = Interpolation[wg1grid, 
            InterpolationOrder -> {3, 3}][w, q2];

xg1[x_, q2_] := wg1[0.939^2 + q2*(1/x - 1), q2];

q2 = 0.3;
Plot[{xg1[x, 0.3], xg1[x, 0.4]}, {x, 0.1, 0.8}, 
        PlotRange -> All, 
        PlotStyle -> colors];
q2 =.

q2 = 1. ;
Plot[{wg1[w, 0.3], wg1[w,  .35], wg1[w,  .5]}, {w, 0.95, 4}, 
      PlotRange -> All, 
      PlotStyle -> colors]
q2 =.

Table[
        x = xgrid[[j]]; {x, xg1[x, 0.3], xg1[x, 0.35], xg1[x, 0.4]}, {j, 
          1, nx}] // TableForm