第一题:
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import numpy as np
import scipy
from scipy.linalg import norm,lstsq
m = 100;
n = 50;
A = np.random.random((m,n));
b = np.random.random((m,1));
x,res,rnk,s =lstsq(A,b)
devi = norm(np.dot(A,x)-b,2);
print(devi);
np.savetxt("wucha.txt",x)# -*- coding: utf-8 -*-
from __future__