octave:2> 40/(2/50) ans = 1000 octave:3> 40/(1/50) ans = 2000 octave:4> stiff yee = -3.00000 0.96000 yei = 0.20000 0.96154 ans = 0.018316 0.960789 yee = 9.00000 0.92160 yei = 0.040000 0.924556 ans = 3.3546e-04 9.2312e-01 yee = -27.00000 0.88474 yei = 0.0080000 0.8889964 ans = 6.1442e-06 8.8692e-01 yee = 81.00000 0.84935 yei = 0.0016000 0.8548042 ans = 1.1254e-07 8.5214e-01 yee = -243.00000 0.81537 yei = 3.2000e-04 8.2193e-01 ans = 2.0612e-09 8.1873e-01 yee = 729.00000 0.78276 yei = 6.4000e-05 7.9031e-01 ans = 3.7751e-11 7.8663e-01 yee = -2.1870e+03 7.5145e-01 yei = 1.2800e-05 7.5992e-01 ans = 6.9144e-13 7.5578e-01 yee = 6.5610e+03 7.2139e-01 yei = 2.5600e-06 7.3069e-01 ans = 1.2664e-14 7.2615e-01 yee = -1.9683e+04 6.9253e-01 yei = 5.1200e-07 7.0259e-01 ans = 2.3195e-16 6.9768e-01 yee = 5.9049e+04 6.6483e-01 yei = 1.0240e-07 6.7556e-01 ans = 4.2484e-18 6.7032e-01 yee = -1.7715e+05 6.3824e-01 yei = 2.0480e-08 6.4958e-01 ans = 7.7811e-20 6.4404e-01 octave:4> stiff eee = 0 eei = 5.0127e-18 octave:5> yee yee = NaN NaN octave:6> yee yee = NaN NaN octave:7> yee-yesatta ans = NaN NaN octave:8> norm(yee-yesatta,inf) ans = 0 octave:9> norm(yee-yesatta) ans = NaN octave:10> version ans = 3.8.1 octave:11> Inf-Inf ans = NaN octave:12> stiff eee = 1 eei = 2.0562e-18 octave:13> stiff eee = 0.13520 eei = 2.0550e-18 octave:14> stiff eee = 1.1741e-18 eei = 1.5825e-18 octave:15> k k = 0.016000 octave:16> stiff eee = 1.2778e+159 eei = 2.4347e-15 eee = 1.2778e+159 5.6327e+255 eei = 2.4347e-15 1.4155e-16 eee = 1.2778e+159 5.6327e+255 0.0000e+00 eei = 2.4347e-15 1.4155e-16 4.5035e-17 eee = 1.2778e+159 5.6327e+255 0.0000e+00 0.0000e+00 eei = 2.4347e-15 1.4155e-16 4.5035e-17 2.3480e-17 eee = 1.2778e+159 5.6327e+255 0.0000e+00 0.0000e+00 0.0000e+00 eei = 2.4347e-15 1.4155e-16 4.5035e-17 2.3480e-17 1.5166e-17 eee = Columns 1 through 5: 1.2778e+159 5.6327e+255 0.0000e+00 0.0000e+00 0.0000e+00 Column 6: 0.0000e+00 eei = Columns 1 through 5: 2.4347e-15 1.4155e-16 4.5035e-17 2.3480e-17 1.5166e-17 Column 6: 1.0984e-17 eee = Columns 1 through 5: 1.2778e+159 5.6327e+255 0.0000e+00 0.0000e+00 0.0000e+00 Columns 6 and 7: 0.0000e+00 0.0000e+00 eei = Columns 1 through 5: 2.4347e-15 1.4155e-16 4.5035e-17 2.3480e-17 1.5166e-17 Columns 6 and 7: 1.0984e-17 8.5285e-18 eee = Columns 1 through 5: 1.2778e+159 5.6327e+255 0.0000e+00 0.0000e+00 0.0000e+00 Columns 6 through 8: 0.0000e+00 0.0000e+00 0.0000e+00 eei = Columns 1 through 5: 2.4347e-15 1.4155e-16 4.5035e-17 2.3480e-17 1.5166e-17 Columns 6 through 8: 1.0984e-17 8.5285e-18 6.9347e-18 eee = Columns 1 through 5: 1.2778e+159 5.6327e+255 0.0000e+00 0.0000e+00 0.0000e+00 Columns 6 through 9: 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 eei = Columns 1 through 5: 2.4347e-15 1.4155e-16 4.5035e-17 2.3480e-17 1.5166e-17 Columns 6 through 9: 1.0984e-17 8.5285e-18 6.9347e-18 5.8254e-18 eee = Columns 1 through 5: 1.2778e+159 5.6327e+255 0.0000e+00 0.0000e+00 0.0000e+00 Columns 6 through 10: 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 eei = Columns 1 through 5: 2.4347e-15 1.4155e-16 4.5035e-17 2.3480e-17 1.5166e-17 Columns 6 through 10: 1.0984e-17 8.5285e-18 6.9347e-18 5.8254e-18 5.0127e-18 warning: axis: omitting non-positive data in log plot warning: axis: omitting non-positive data in log plot octave:17> stiff warning: axis: omitting non-positive data in log plot warning: axis: omitting non-positive data in log plot octave:18> eee eee = Columns 1 through 5: 1.2778e+159 5.6327e+255 0.0000e+00 0.0000e+00 0.0000e+00 Columns 6 through 10: 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 octave:19> stiff warning: axis: omitting non-positive data in log plot warning: axis: omitting non-positive data in log plot octave:20> stiff octave:21> stiff octave:22> stiff error: invalid use of end error: evaluating argument list element number 1 error: evaluating argument list element number 5 error: called from: error: /home/accounts/personale/clrmrc90/aa1718/equazioni_differenziali/stiff.m at line 20, column 1 octave:22> stiff octave:23> stiff octave:24> stiff octave:25> stiff octave:26> stiff octave:27> stiff octave:28> eee eee = Columns 1 through 5: 3.1824e+16 4.2940e+15 5.7823e+14 7.7709e+13 1.0422e+13 Columns 6 through 10: 1.3951e+12 1.8636e+11 2.4845e+10 3.3056e+09 4.3892e+08 octave:29> eei eei = Columns 1 through 7: 0.48372 0.48343 0.48314 0.48285 0.48257 0.48228 0.48199 Columns 8 through 10: 0.48170 0.48142 0.48113 octave:30> stiff octave:31> eee eee = Columns 1 through 5: 2.3539e+17 3.1824e+16 4.2940e+15 5.7823e+14 7.7709e+13 Columns 6 through 10: 1.0422e+13 1.3951e+12 1.8636e+11 2.4845e+10 3.3056e+09 Column 11: 4.3892e+08 octave:32> octave:32> eee eee = Columns 1 through 5: 2.3539e+17 3.1824e+16 4.2940e+15 5.7823e+14 7.7709e+13 Columns 6 through 10: 1.0422e+13 1.3951e+12 1.8636e+11 2.4845e+10 3.3056e+09 Column 11: 4.3892e+08 octave:33> eei eei = Columns 1 through 7: 0.48401 0.48372 0.48343 0.48314 0.48285 0.48257 0.48228 Columns 8 through 11: 0.48199 0.48170 0.48142 0.48113 octave:34> octave:34> eee eee = Columns 1 through 5: 2.3539e+17 3.1824e+16 4.2940e+15 5.7823e+14 7.7709e+13 Columns 6 through 10: 1.0422e+13 1.3951e+12 1.8636e+11 2.4845e+10 3.3056e+09 Column 11: 4.3892e+08 octave:35> stiff octave:36> m=100; octave:37> h=1/(m-1); octave:38> A=toeplitz(sparse([1,1],[1,2],[-2,1]/h^2,1,m)); octave:39> eig(A) ans = -3.9195e+04 -3.9166e+04 -3.9119e+04 -3.9052e+04 -3.8967e+04 -3.8864e+04 -3.8741e+04 -3.8600e+04 -3.8441e+04 -3.8263e+04 -3.8068e+04 -3.7854e+04 -3.7623e+04 -3.7375e+04 -3.7109e+04 -3.6826e+04 -3.6527e+04 -3.6211e+04 -3.5879e+04 -3.5532e+04 -3.5169e+04 -3.4791e+04 -3.4398e+04 -3.3991e+04 -3.3570e+04 -3.3136e+04 -3.2688e+04 -3.2228e+04 -3.1755e+04 -3.1271e+04 -3.0776e+04 -3.0269e+04 -2.9753e+04 -2.9226e+04 -2.8691e+04 -2.8146e+04 -2.7593e+04 -2.7033e+04 -2.6465e+04 -2.5891e+04 -2.5310e+04 -2.4724e+04 -2.4134e+04 -2.3538e+04 -2.2939e+04 -2.2337e+04 -2.1732e+04 -2.1125e+04 -2.0516e+04 -1.9907e+04 -1.9297e+04 -1.8688e+04 -1.8079e+04 -1.7472e+04 -1.6867e+04 -1.6265e+04 -1.5666e+04 -1.5070e+04 -1.4480e+04 -1.3894e+04 -1.3313e+04 -1.2739e+04 -1.2171e+04 -1.1611e+04 -1.1058e+04 -1.0513e+04 -9.9775e+03 -9.4511e+03 -8.9345e+03 -8.4282e+03 -7.9328e+03 -7.4486e+03 -6.9761e+03 -6.5159e+03 -6.0684e+03 -5.6339e+03 -5.2130e+03 -4.8060e+03 -4.4133e+03 -4.0352e+03 -3.6723e+03 -3.3247e+03 -2.9929e+03 -2.6772e+03 -2.3779e+03 -2.0952e+03 -1.8294e+03 -1.5808e+03 -1.3497e+03 -1.1362e+03 -9.4064e+02 -7.6309e+02 -6.0376e+02 -4.6281e+02 -3.4038e+02 -2.3659e+02 -1.5153e+02 -8.5281e+01 -3.7918e+01 -9.4818e+00 octave:40> octave:40> octave:40> octave:40> octave:40> octave:40> octave:40> octave:40> octave:40> octave:40> octave:40> A=rand(2) A = 0.876234 0.108252 0.884270 0.068573 octave:41> exp(A) ans = 2.4018 1.1143 2.4212 1.0710 octave:42> expm(A) ans = 2.49188 0.18121 1.48020 1.13992 octave:43> eye(2)+A+A^2/2+A^3/6+A^4/24 ans = 2.48380 0.18025 1.47237 1.13899 octave:44> eye(2)+A/2+A^2/6+A^3/24+A^4/120 ans = 1.624256 0.076181 0.622293 1.055876 octave:45> (expm(A)-eye(2))/A ans = 1.625569 0.076336 0.623565 1.056027 octave:46> A\(expm(A)-eye(2)) ans = 1.625569 0.076336 0.623565 1.056027 octave:47> help lsode 'lsode' is a built-in function from the file libinterp/corefcn/lsode.cc -- Built-in Function: [X, ISTATE, MSG] = lsode (FCN, X_0, T) -- Built-in Function: [X, ISTATE, MSG] = lsode (FCN, X_0, T, T_CRIT) Solve the set of differential equations dx -- = f (x, t) dt with x(t_0) = x_0 The solution is returned in the matrix X, with each row corresponding to an element of the vector T. The first element of T should be t_0 and should correspond to the initial state of the system X_0, so that the first row of the output is X_0. The first argument, FCN, is a string, inline, or function handle that names the function f to call to compute the vector of right hand sides for the set of equations. The function must have the form XDOT = f (X, T) in which XDOT and X are vectors and T is a scalar. If FCN is a two-element string array or a two-element cell array of strings, inline functions, or function handles, the first element names the function f described above, and the second element names a function to compute the Jacobian of f. The Jacobian function must have the form JAC = j (X, T) in which JAC is the matrix of partial derivatives | df_1 df_1 df_1 | | ---- ---- ... ---- | | dx_1 dx_2 dx_N | | | | df_2 df_2 df_2 | | ---- ---- ... ---- | df_i | dx_1 dx_2 dx_N | jac = ---- = | | dx_j | . . . . | | . . . . | | . . . . | | | | df_N df_N df_N | | ---- ---- ... ---- | | dx_1 dx_2 dx_N | The second and third arguments specify the initial state of the system, x_0, and the initial value of the independent variable t_0. The fourth argument is optional, and may be used to specify a set of times that the ODE solver should not integrate past. It is useful for avoiding difficulties with singularities and points where there is a discontinuity in the derivative. After a successful computation, the value of ISTATE will be 2 (consistent with the Fortran version of LSODE). If the computation is not successful, ISTATE will be something other than 2 and MSG will contain additional information. You can use the function 'lsode_options' to set optional parameters for 'lsode'. See also: daspk, dassl, dasrt. 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:48> stiff parse error near line 24 of file /home/accounts/personale/clrmrc90/aa1718/equazioni_differenziali/stiff.m syntax error >>> tsrange,eei(end)*(tsrange/tsrange(end)).^(-1))) ^ octave:48> stiff octave:49> stiff octave:50> stiff octave:51> stiff octave:52> stiff octave:53> diary ogg