14-Oct-2013 1> eps ans = 2.2204e-016 2> format long 3> eps ans = 2.22044604925031e-016 4> 2^(-52) ans = 2.22044604925031e-016 5> 1 + eps ans = 1.00000000000000 6> if (1 + eps == 1) disp('si') else disp('no') end no 7> if (1 + eps/2 == 1) disp('si') else disp('no') end si 8> eps/2 ans = 1.11022302462516e-016 9> realmin ans = 2.22507385850720e-308 10> realmin^2 ans = 0 11> pwd() ans = C:\cygwin\home\achilles 12> x = 1.e-15 x = 1.00000000000000e-015 13> ((x + 1) -1)/x ans = 1.11022302462516 14> x = [-2 -1 0 1 2] x = -2 -1 0 1 2 15> y = 2 .^ x y = 0.250000000000000 0.500000000000000 1.000000000000000 2.000000000000000 4.000000000000000 16> format 17> y = 2 .^ x y = 0.25000 0.50000 1.00000 2.00000 4.00000 18> plot(x,y) 19> x = linspace(-2,2) x = Columns 1 through 10: -2.000000 -1.959596 -1.919192 -1.878788 -1.838384 -1.797980 -1.757576 -1.717172 -1.676768 -1.636364 Columns 11 through 20: -1.595960 -1.555556 -1.515152 -1.474747 -1.434343 -1.393939 -1.353535 -1.313131 -1.272727 -1.232323 Columns 21 through 30: -1.191919 -1.151515 -1.111111 -1.070707 -1.030303 -0.989899 -0.949495 -0.909091 -0.868687 -0.828283 Columns 31 through 40: -0.787879 -0.747475 -0.707071 -0.666667 -0.626263 -0.585859 -0.545455 -0.505051 -0.464646 -0.424242 Columns 41 through 50: -0.383838 -0.343434 -0.303030 -0.262626 -0.222222 -0.181818 -0.141414 -0.101010 -0.060606 -0.020202 Columns 51 through 60: 0.020202 0.060606 0.101010 0.141414 0.181818 0.222222 0.262626 0.303030 0.343434 0.383838 Columns 61 through 70: 0.424242 0.464646 0.505051 0.545455 0.585859 0.626263 0.666667 0.707071 0.747475 0.787879 Columns 71 through 80: 0.828283 0.868687 0.909091 0.949495 0.989899 1.030303 1.070707 1.111111 1.151515 1.191919 Columns 81 through 90: 1.232323 1.272727 1.313131 1.353535 1.393939 1.434343 1.474747 1.515152 1.555556 1.595960 Columns 91 through 100: 1.636364 1.676768 1.717172 1.757576 1.797980 1.838384 1.878788 1.919192 1.959596 2.000000 20> x = linspace(-2,2); 21> size(x) ans = 1 100 22> length(x) ans = 100 23> y = 2 .^ x; 24> length(y) ans = 100 25> plot(x,y) 26> hold on 27> y3 = 3 .^ x; 28> plot(x,y3, 'r') 29> axis equal 30> axis equal off 31> yexp = exp(x); 32> plot(x,yexp, 'g') 33> axis on 34> grid on 35> exp(1) ans = 2.7183 36> format long 37> e ans = 2.71828182845905 38> pi ans = 3.14159265358979 39> % occorre caricare la funzione costante % http://www.dm.unibo.it/~achilles/calc/programmi/N_A.m urlwrite("http://www.dm.unibo.it/~achilles/calc/programmi/N_A.m","N_A.m") 39> N_A ans = 6.02214179000000e+023 40> hold off 41> x = linspace(1-1.e-5,1+1.e-5); 42> y = (x - 1).^3; 43> yy = x.^3 - 3*x.^2 + 3*x -1; 44> plot (x,y) 45> hold on 46> plot (x,yy, 'r') 47> hold off 48> quit