If it is of any value, below is the script I used. It might not be a good sample for learning Python/Numpy; in particular the data initialization looks weird because I used cut & paste from your post, which required some transformation.
import numpy as np
import matplotlib.pyplot as plt
a1 = np.array ([ 7.77607, 1.244171, 2.24939, 360.2472, 3172.015, 5414.629, 9919.601,
5713.587, 622.4648, 9754.563, 2386.268, 1749.93, 2518.545, 13.27551,
264.4758, 11082.13, 4506.733, 11693.03, 6.878544, 46.29824, 44.39463,
9.470855, 47.77485, 23.25118, 182.1844]);
a2 = np.array ([ 11.8903, 2.457329, 13.48148, 1.666301, 0.466564, 2.694754, 6.705258,
0.894034, 8.011056, 3.415775, 0.318806, 4.540519, 11.76087, 1.881739,
13.34492, 0.607034, 0.024281, 1.577185, 2.882097, 0.438079, 3.977468,
1.16396, 0.093117, 2.164764, 0.235619, 0.022619, 1.185328, 0.213314,
0.015643, 1.161795, 0.248186, 0.024157, 1.198586, 0.71432,
0.061908, 1.690376, 27.29997, 7.461992, 29.7393, 2.565896, 0.307907,
3.643863, 1.364708, 0.181961, 2.376561, 12.60996, 1.849461, 14.24075]);
a1a = a1.reshape (-1,5).T;
a2a = a2.reshape (-1,3).T;
x = np.hstack ((a1a[0,:], a2a[0,:]));
y1 = np.hstack ((a1a[1,:], a2a[1,:]));
y2 = np.hstack ((a1a[2,:], a2a[2,:]));
xG = a1a[3,:];
yG = a1a[4,:];
x = np.log (x);
y1 = np.log (y1);
y2 = np.log (y2);
xG = np.log (xG);
yG = np.log (yG);
plt.plot ( (x), (y1), '.', color='gray', markersize=10);
plt.plot ( (xG), (yG), '.', color='blue', markersize=10);
def regr (x,y):
A = np.vstack ((x, np.full (x.shape, 1))).T;
AA1 = np.linalg.inv (np.matmul (A.T,A));
r1 = np.matmul (np.matmul (AA1, A.T), y.T);
return r1;
a,b = regr (x, y1);
print (a,b);
x0 = np.min (x);
x1 = np.max (x);
plt.plot ([x0,x1], [a*x0+b, a*x1+b], '.-', color='gray')
a2,b2 = regr (xG, yG);
print (a2,b2);
x0 = np.min (xG);
x1 = np.max (xG);
plt.plot ([x0,x1], [a2*x0+b2, a2*x1+b2], '.-', color='blue')
u = a2/a;
v = b2 - u*b;
y3 = u*y1 + v;
plt.plot ( (x), (y3), '.', color='green', markersize=10);
plt.grid ();
plt.show ();