octave:2> catenaria1 octave:3> catenaria1 octave:4> catenaria1 octave:5> octave:5> catenaria2 parse error near line 52 of file /home/accounts/personale/clrmrc90/aa1819/equazioni_differenziali/catenaria2.m syntax error >>> end ^ octave:5> catenaria2 error: catenaria2: subscript indices must be either positive integers less than 2^31 or logicals error: called from: error: /home/accounts/personale/clrmrc90/aa1819/equazioni_differenziali/catenaria2.m at line 51, column 18 octave:5> catenaria2 error: catenaria2: subscript indices must be either positive integers less than 2^31 or logicals error: called from: error: /home/accounts/personale/clrmrc90/aa1819/equazioni_differenziali/catenaria2.m at line 51, column 18 octave:5> catenaria2 err = 3.7866e-04 err = 3.7866e-04 6.0399e-05 err = 3.7866e-04 6.0399e-05 1.4984e-05 err = 3.7866e-04 6.0399e-05 1.4984e-05 3.6324e-06 error: for A^b, A must be a square matrix. Use .^ for elementwise power. error: evaluating argument list element number 5 error: called from: error: /home/accounts/personale/clrmrc90/aa1819/equazioni_differenziali/catenaria2.m at line 55, column 1 octave:5> catenaria2 err = 3.7866e-04 err = 3.7866e-04 6.0399e-05 err = 3.7866e-04 6.0399e-05 1.4984e-05 err = 3.7866e-04 6.0399e-05 1.4984e-05 3.6324e-06 octave:6> catenaria2 warning: axis: omitting non-positive data in log plot warning: axis: omitting non-positive data in log plot octave:7> catenaria2 octave:8> catenaria2 octave:9> catenaria2 octave:10> catenaria2 octave:11> catenaria2 octave:12> catenaria2 octave:13> spdiags([[1;2;3],[4;5;6],[7;8;9]],[-1,0,1],3,3) ans = Compressed Column Sparse (rows = 3, cols = 3, nnz = 7 [78%]) (1, 1) -> 4 (2, 1) -> 1 (1, 2) -> 8 (2, 2) -> 5 (3, 2) -> 2 (2, 3) -> 9 (3, 3) -> 6 octave:14> full(spdiags([[1;2;3],[4;5;6],[7;8;9]],[-1,0,1],3,3)) ans = 4 8 0 1 5 9 0 2 6 octave:15> spdiags([[1;2;NaN],[4;5;6],[7;8;NaN]],[-1,0,1],3,3) ans = Compressed Column Sparse (rows = 3, cols = 3, nnz = 7 [78%]) (1, 1) -> 4 (2, 1) -> 1 (1, 2) -> 8 (2, 2) -> 5 (3, 2) -> 2 (2, 3) -> NaN (3, 3) -> 6 octave:16> spdiags([[1;2;NaN],[4;5;6],[NaN;8;9]],[-1,0,1],3,3) ans = Compressed Column Sparse (rows = 3, cols = 3, nnz = 7 [78%]) (1, 1) -> 4 (2, 1) -> 1 (1, 2) -> 8 (2, 2) -> 5 (3, 2) -> 2 (2, 3) -> 9 (3, 3) -> 6 octave:17> A=sprand(10,10,0.2) A = Compressed Column Sparse (rows = 10, cols = 10, nnz = 20 [20%]) (3, 1) -> 0.015186 (7, 1) -> 0.18401 (10, 1) -> 0.70018 (2, 2) -> 0.34466 (9, 2) -> 0.32323 (4, 3) -> 0.66914 (7, 3) -> 0.25989 (8, 3) -> 0.79254 (10, 3) -> 0.56714 (6, 4) -> 0.030698 (9, 4) -> 0.22302 (2, 5) -> 0.97606 (1, 6) -> 0.23110 (5, 6) -> 0.71650 (2, 7) -> 0.28633 (9, 8) -> 0.032162 (2, 9) -> 0.011994 (8, 9) -> 0.046246 (5, 10) -> 0.60377 (9, 10) -> 0.67359 octave:18> octave:18> octave:18> full(A) ans = Columns 1 through 8: 0.00000 0.00000 0.00000 0.00000 0.00000 0.23110 0.00000 0.00000 0.00000 0.34466 0.00000 0.00000 0.97606 0.00000 0.28633 0.00000 0.01519 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.66914 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.71650 0.00000 0.00000 0.00000 0.00000 0.00000 0.03070 0.00000 0.00000 0.00000 0.00000 0.18401 0.00000 0.25989 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.79254 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.32323 0.00000 0.22302 0.00000 0.00000 0.00000 0.03216 0.70018 0.00000 0.56714 0.00000 0.00000 0.00000 0.00000 0.00000 Columns 9 and 10: 0.00000 0.00000 0.01199 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.60377 0.00000 0.00000 0.00000 0.00000 0.04625 0.00000 0.00000 0.67359 0.00000 0.00000 octave:19> full(A) ans = Columns 1 through 8: 0.00000 0.00000 0.00000 0.00000 0.00000 0.23110 0.00000 0.00000 0.00000 0.34466 0.00000 0.00000 0.97606 0.00000 0.28633 0.00000 0.01519 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.66914 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.71650 0.00000 0.00000 0.00000 0.00000 0.00000 0.03070 0.00000 0.00000 0.00000 0.00000 0.18401 0.00000 0.25989 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.79254 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.32323 0.00000 0.22302 0.00000 0.00000 0.00000 0.03216 0.70018 0.00000 0.56714 0.00000 0.00000 0.00000 0.00000 0.00000 Columns 9 and 10: 0.00000 0.00000 0.01199 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.60377 0.00000 0.00000 0.00000 0.00000 0.04625 0.00000 0.00000 0.67359 0.00000 0.00000 octave:20> octave:20> nnz(A) ans = 20 octave:21> [L,U,P]=lu(A); octave:22> nnz(L) ans = 18 octave:23> nnz(U) ans = 15 octave:24> help lu 'lu' is a built-in function from the file libinterp/corefcn/lu.cc -- Built-in Function: [L, U] = lu (A) -- Built-in Function: [L, U, P] = lu (A) -- Built-in Function: [L, U, P, Q] = lu (S) -- Built-in Function: [L, U, P, Q, R] = lu (S) -- Built-in Function: [...] = lu (S, THRES) -- Built-in Function: Y = lu (...) -- Built-in Function: [...] = lu (..., "vector") Compute the LU decomposition of A. If A is full subroutines from LAPACK are used and if A is sparse then UMFPACK is used. The result is returned in a permuted form, according to the optional return value P. For example, given the matrix 'a = [1, 2; 3, 4]', [l, u, p] = lu (A) returns l = 1.00000 0.00000 0.33333 1.00000 u = 3.00000 4.00000 0.00000 0.66667 p = 0 1 1 0 The matrix is not required to be square. When called with two or three output arguments and a spare input matrix, 'lu' does not attempt to perform sparsity preserving column permutations. Called with a fourth output argument, the sparsity preserving column transformation Q is returned, such that 'P * A * Q = L * U'. Called with a fifth output argument and a sparse input matrix, 'lu' attempts to use a scaling factor R on the input matrix such that 'P * (R \ A) * Q = L * U'. This typically leads to a sparser and more stable factorization. An additional input argument THRES, that defines the pivoting threshold can be given. THRES can be a scalar, in which case it defines the UMFPACK pivoting tolerance for both symmetric and unsymmetric cases. If THRES is a 2-element vector, then the first element defines the pivoting tolerance for the unsymmetric UMFPACK pivoting strategy and the second for the symmetric strategy. By default, the values defined by 'spparms' are used ([0.1, 0.001]). Given the string argument "vector", 'lu' returns the values of P and Q as vector values, such that for full matrix, 'A (P,:) = L * U', and 'R(P,:) * A (:, Q) = L * U'. With two output arguments, returns the permuted forms of the upper and lower triangular matrices, such that 'A = L * U'. With one output argument Y, then the matrix returned by the LAPACK routines is returned. If the input matrix is sparse then the matrix L is embedded into U to give a return value similar to the full case. For both full and sparse matrices, 'lu' loses the permutation information. See also: luupdate, chol, hess, qr, qz, schur, svd. Additional help for built-in functions and operators is available in the online version of the manual. Use the command 'doc ' to search the manual index. Help and information about Octave is also available on the WWW at http://www.octave.org and via the help@octave.org mailing list. octave:25> [L,U,P,Q]=lu(A); octave:26> nnz(L) ans = 14 octave:27> nnz(U) ans = 16 octave:28> diary 'off'