import numpy
import scipy.optimize as opt
m=int(input())
n=int(input())
A = numpy.random.rand(m, n)
b = numpy.random.random(m)
res = opt.lsq_linear(A,b)
norm = numpy.linalg.norm(b - numpy.dot(A, res.x))
print(norm)
def f(x):
res = numpy.power(numpy.sin(x-2), 2) * numpy.exp(-1*(x**2))
return -1 * res
res = opt.minimize_scalar(f)
print(-1*f(res.x))
import numpy
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import scipy.spatial.distance as dis
n=int(input())
m=int(input())
X=numpy.random.rand(n,m)
x=[]
y=[]
for a in range(0, n//2):
x = x + [a for c in range(1, n)]
y = y + [b for b in range(1, n)]
#print(x)
#print(y)
x = numpy.array(x)
y = numpy.array(y)
ax = Axes3D(plt.figure())
ax.set_xlabel('Firt City')
ax.set_ylabel('Second City')
ax.set_zlabel('Distance')
ax.scatter(x, y, dis.pdist(X), c='r')
plt.show()