G = hilbert_matrix(7)
f = matrix(RR,[[.483789], [.319461], [.237879], [.189239], [.156991], [.134069], [.116951]])
a = G\f
print "G ="
print G
print "\nf ="
print f
print "\na ="
print a.change_ring(RR)
var('q, r, s, t, u, v, w, x')
p(q,r,s,t,u,v,w) = q + r*x + s*x^2 + t*x^3 + u*x^4 + v*x^5 + w*x^6
print "\np(x) =",
p(float(a[0,0]), float(a[1,0]), float(a[2,0]), float(a[3,0]), float(a[4,0]), float(a[5,0]), float(a[6,0]))
|
|
G =
[ 1 1/2 1/3 1/4 1/5 1/6 1/7]
[ 1/2 1/3 1/4 1/5 1/6 1/7 1/8]
[ 1/3 1/4 1/5 1/6 1/7 1/8 1/9]
[ 1/4 1/5 1/6 1/7 1/8 1/9 1/10]
[ 1/5 1/6 1/7 1/8 1/9 1/10 1/11]
[ 1/6 1/7 1/8 1/9 1/10 1/11 1/12]
[ 1/7 1/8 1/9 1/10 1/11 1/12 1/13]
f =
[0.483789000000000]
[0.319461000000000]
[0.237879000000000]
[0.189239000000000]
[0.156991000000000]
[0.134069000000000]
[0.116951000000000]
a =
[-0.0152250000000000]
[ 1.57651200000000]
[ -5.32854000000000]
[ 20.0340000000000]
[ -35.7241500000000]
[ 30.0484800000000]
[ -9.69368400000000]
p(x) = -9.6936839999999993*x^6 + 30.048479999999998*x^5 -
35.724149999999995*x^4 + 20.033999999999999*x^3 - 5.3285399999999994*x^2
+ 1.5765119999999999*x - 0.015224999999999999
G =
[ 1 1/2 1/3 1/4 1/5 1/6 1/7]
[ 1/2 1/3 1/4 1/5 1/6 1/7 1/8]
[ 1/3 1/4 1/5 1/6 1/7 1/8 1/9]
[ 1/4 1/5 1/6 1/7 1/8 1/9 1/10]
[ 1/5 1/6 1/7 1/8 1/9 1/10 1/11]
[ 1/6 1/7 1/8 1/9 1/10 1/11 1/12]
[ 1/7 1/8 1/9 1/10 1/11 1/12 1/13]
f =
[0.483789000000000]
[0.319461000000000]
[0.237879000000000]
[0.189239000000000]
[0.156991000000000]
[0.134069000000000]
[0.116951000000000]
a =
[-0.0152250000000000]
[ 1.57651200000000]
[ -5.32854000000000]
[ 20.0340000000000]
[ -35.7241500000000]
[ 30.0484800000000]
[ -9.69368400000000]
p(x) = -9.6936839999999993*x^6 + 30.048479999999998*x^5 - 35.724149999999995*x^4 + 20.033999999999999*x^3 - 5.3285399999999994*x^2 + 1.5765119999999999*x - 0.015224999999999999
|