author | francesco-ST <francesco.abbate@st.com> | 2011年02月09日 14:12:08 +0100 |
---|---|---|
committer | francesco-ST <francesco.abbate@st.com> | 2011年02月09日 14:12:08 +0100 |
commit | 7b42e27a13e86b32e0ad1a86cdb05ba93993b45d (patch) | |
tree | 82cc5ad66f863ee9e97b9c6dc7c2a366e570121e | |
parent | 94bc532ac06039825456a1645b5aa754fe447ff0 (diff) | |
download | gsl-shell-7b42e27a13e86b32e0ad1a86cdb05ba93993b45d.tar.gz |
-rw-r--r-- | examples/bspline.lua | 2 | ||||
-rw-r--r-- | examples/eigensystems.lua | 22 | ||||
-rw-r--r-- | examples/linfit.lua | 2 | ||||
-rw-r--r-- | examples/nlinfit.lua | 2 |
diff --git a/examples/bspline.lua b/examples/bspline.lua index 00ef700a..e041d4a2 100644 --- a/examples/bspline.lua +++ b/examples/bspline.lua @@ -22,7 +22,7 @@ function demo1() local c, cov = mlinear(X, y, w) local p = plot('B-splines curve approximation') - p:addline(xyline(x, mul(X, c))) + p:addline(xyline(x, X*c)) p:addline(xyline(x, y), 'blue', {{'marker', size=5}}) p:show() diff --git a/examples/eigensystems.lua b/examples/eigensystems.lua index a4b00a7b..fc25b2e3 100644 --- a/examples/eigensystems.lua +++ b/examples/eigensystems.lua @@ -7,29 +7,31 @@ end function demo1() local m = new(4, 4, |i,j| 1/(i+j-1)) - print('Matrix:') - print(m, '\n') + echo 'Matrix:' + print(m) local e, v = eigsv(m) - print('Eigenvalues:', ilist(|i| e[i], 4), '\n') + echo('Eigenvalues:') + print(ilist(|i| e[i], 4)) -- the following expression will give a diagonal matrix with the eigenvalues --- along the diagonal - print('Matrix diagonal form:') - print(prod(v,mul(m,v))) + echo('Matrix diagonal form:') + print(prod(v, m*v)) end function demo2() local m = vandermonde {-1, -2, 3, 4} - print('Matrix:') - print(m, '\n') + echo 'Matrix:' + print(m) local e, v = eignsv(m) - print('Eigenvalues:', ilist(|i| e[i], 4), '\n') + echo 'Eigenvalues:' + print(ilist(|i| e[i], 4)) -- the following expression will give a diagonal matrix with the eigenvalues --- along the diagonal - print('Matrix diagonal form:') - print(mul(inv(v),m,v)) + echo('Matrix diagonal form:') + print(inv(v) * m * v) end echo([[ diff --git a/examples/linfit.lua b/examples/linfit.lua index 2e1a61aa..6079b661 100644 --- a/examples/linfit.lua +++ b/examples/linfit.lua @@ -54,7 +54,7 @@ function demo3() local legmodel = |j, x| j == 0 and 1 or legendreP(j, xn(x)) local X = new(n, kfit+1, |i,j| legmodel(j-1, x[i])) local c = mlinear(X, y) - local yfit = mul(X, c) + local yfit = X * c p = plot('Legendre Polinomial fit of Bessel J3(x)') p:addline(xyline(x, yfit)) p:addline(xyline(x, y), 'blue', {{'marker', size=5}}) diff --git a/examples/nlinfit.lua b/examples/nlinfit.lua index 14f88e8d..d55c0880 100644 --- a/examples/nlinfit.lua +++ b/examples/nlinfit.lua @@ -39,7 +39,7 @@ function demo1() local function print_state(s) print ("x: ", tr(s.p)) - print ("chi square: ", mul(hc(s.f), s.f)[1]) + print ("chi square: ", (hc(s.f) * s.f)[1]) end s = cnlfsolver {fdf= cexpf, n= n, p0= vector {2.1, -2.8, 18, 0}} |