octave:2> x=[1,2,3] x = 1 2 3 octave:3> y=[4;5;6] y = 4 5 6 octave:4> x*y ans = 32 octave:5> x*x error: operator *: nonconformant arguments (op1 is 1x3, op2 is 1x3) error: evaluating binary operator `*' near line 5, column 2 octave:5> y=y' y = 4 5 6 octave:6> x*y error: operator *: nonconformant arguments (op1 is 1x3, op2 is 1x3) error: evaluating binary operator `*' near line 6, column 2 octave:6> x x = 1 2 3 octave:7> x.*y ans = 4 10 18 octave:8> x^2 error: for A^b, A must be square error: evaluating binary operator `^' near line 8, column 2 octave:8> x.^2 ans = 1 4 9 octave:9> sin(x) ans = 0.84147 0.90930 0.14112 octave:10> x*exp(x) error: operator *: nonconformant arguments (op1 is 1x3, op2 is 1x3) error: evaluating binary operator `*' near line 10, column 2 octave:10> x x = 1 2 3 octave:11> exp(x) ans = 2.7183 7.3891 20.0855 octave:12> x.*exp(x) ans = 2.7183 14.7781 60.2566 octave:13> help integranda y = x^n*exp(x-1); /home/accounts/altri/caliari/aa0809/calcolo_numerico/floating/integranda.m Additional help for built-in functions and operators is available in the on-line 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:14> integranda(x,2) ans = 1.0000 10.8731 66.5015 octave:15> octave:15> esercizio6 warning: axis: omitting nonpositive data in log plot warning: axis: omitting nonpositive data in log plot octave:16> Iavanti Iavanti = Columns 1 through 5: 3.6788e-01 2.6424e-01 2.0728e-01 1.7089e-01 1.4553e-01 Columns 6 through 10: 1.2680e-01 1.1238e-01 1.0093e-01 9.1612e-02 8.3877e-02 Columns 11 through 15: 7.7352e-02 7.1773e-02 6.6948e-02 6.2731e-02 5.9034e-02 Columns 16 through 20: 5.5459e-02 5.7192e-02 -2.9454e-02 1.5596e+00 -3.0192e+01 Columns 21 through 25: 6.3504e+02 -1.3970e+04 3.2131e+05 -7.7114e+06 1.9279e+08 Columns 26 through 30: -5.0124e+09 1.3534e+11 -3.7894e+12 1.0989e+14 -3.2968e+15 octave:17> Iriferimento Iriferimento = Columns 1 through 6: 0.367879 0.264241 0.207277 0.170893 0.145533 0.126802 Columns 7 through 12: 0.112384 0.100932 0.091612 0.083877 0.077352 0.071773 Columns 13 through 18: 0.066948 0.062732 0.059018 0.055719 0.052771 0.050120 Columns 19 through 24: 0.047723 0.045545 0.043557 0.041736 0.040062 0.038517 Columns 25 through 30: 0.037086 0.035758 0.034523 0.033369 0.032291 0.031280 octave:18> octave:18> octave:18> octave:18> octave:18> octave:18> octave:18> octave:18> Iavanti Iavanti = Columns 1 through 5: 3.6788e-01 2.6424e-01 2.0728e-01 1.7089e-01 1.4553e-01 Columns 6 through 10: 1.2680e-01 1.1238e-01 1.0093e-01 9.1612e-02 8.3877e-02 Columns 11 through 15: 7.7352e-02 7.1773e-02 6.6948e-02 6.2731e-02 5.9034e-02 Columns 16 through 20: 5.5459e-02 5.7192e-02 -2.9454e-02 1.5596e+00 -3.0192e+01 Columns 21 through 25: 6.3504e+02 -1.3970e+04 3.2131e+05 -7.7114e+06 1.9279e+08 Columns 26 through 30: -5.0124e+09 1.3534e+11 -3.7894e+12 1.0989e+14 -3.2968e+15 octave:19> octave:19> octave:19> octave:19> octave:19> octave:19> octave:19> esercizio6 warning: axis: omitting nonpositive data in log plot warning: axis: omitting nonpositive data in log plot octave:20> print('-deps','prova-eps') octave:21> help print -- Function File: print (FILENAME, OPTIONS) Print a graph, or save it to a file FILENAME defines the file name of the output file. If no filename is specified, output is sent to the printer. OPTIONS: `-PPRINTER' Set the PRINTER name to which the graph is sent if no FILENAME is specified. `-color' `-mono' Monochrome or colour lines. `-solid' `-dashed' Solid or dashed lines. `-portrait' `-landscape' Plot orientation, as returned by "orient". `-dDEVICE' Output device, where DEVICE is one of: `ps' `ps2' `psc' `psc2' Postscript (level 1 and 2, mono and color) `eps' `eps2' `epsc' `epsc2' Encapsulated postscript (level 1 and 2, mono and color) `tex' `epslatex' `epslatexstandalone' `pstex' `pslatex' Generate a LaTeX (or TeX) file for labels, and eps/ps for graphics. The file produced by `epslatexstandalone' can be processed directly by LaTeX. The other formats are intended to be included in a LaTeX (or TeX) document. The `tex' device is the same as the `epslatex' device. `ill' `aifm' Adobe Illustrator `cdr' `corel' CorelDraw `dxf' AutoCAD `emf' Microsoft Enhanced Metafile `fig' XFig. If this format is selected the additional options `-textspecial' or `-textnormal' can be used to control whether the special flag should be set for the text in the figure (default is `-textnormal'). `hpgl' HP plotter language `mf' Metafont `png' Portable network graphics `jpg' `jpeg' JPEG image `gif' GIF image `pbm' PBMplus `svg' Scalable vector graphics `pdf' Portable document format Other devices are supported by "convert" from ImageMagick. Type system("convert") to see what formats are available. If the device is omitted, it is inferred from the file extension, or if there is no filename it is sent to the printer as postscript. `-SXSIZE,YSIZE' Plot size in pixels for PNG and SVG. If using the command form of the print function, you must quote the XSIZE,YSIZE option. For example, by writing `"-S640,480"'. `-FFONTNAME' `-FFONTNAME:SIZE' `-F:SIZE' FONTNAME set the postscript font (for use with postscript, aifm, corel and fig). By default, 'Helvetica' is set for PS/Aifm, and 'SwitzerlandLight' for Corel. It can also be 'Times-Roman'. SIZE is given in points. FONTNAME is ignored for the fig device. The filename and options can be given in any order. /usr/local/octave-3.0.2/share/octave/3.0.2/m/plot/print.m Additional help for built-in functions and operators is available in the on-line 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:22> print('-dpng','prova.png') octave:23> print('-dpng','prova.png') octave:24> close all octave:25> esercizio6 warning: axis: omitting nonpositive data in log plot warning: axis: omitting nonpositive data in log plot octave:26> print('-dpng','prova.png') octave:27> print('-dpdf','prova.pdf') octave:28> help print -- Function File: print (FILENAME, OPTIONS) Print a graph, or save it to a file FILENAME defines the file name of the output file. If no filename is specified, output is sent to the printer. OPTIONS: `-PPRINTER' Set the PRINTER name to which the graph is sent if no FILENAME is specified. `-color' `-mono' Monochrome or colour lines. `-solid' `-dashed' Solid or dashed lines. `-portrait' `-landscape' Plot orientation, as returned by "orient". `-dDEVICE' Output device, where DEVICE is one of: `ps' `ps2' `psc' `psc2' Postscript (level 1 and 2, mono and color) `eps' `eps2' `epsc' `epsc2' Encapsulated postscript (level 1 and 2, mono and color) `tex' `epslatex' `epslatexstandalone' `pstex' `pslatex' Generate a LaTeX (or TeX) file for labels, and eps/ps for graphics. The file produced by `epslatexstandalone' can be processed directly by LaTeX. The other formats are intended to be included in a LaTeX (or TeX) document. The `tex' device is the same as the `epslatex' device. `ill' `aifm' Adobe Illustrator `cdr' `corel' CorelDraw `dxf' AutoCAD `emf' Microsoft Enhanced Metafile `fig' XFig. If this format is selected the additional options `-textspecial' or `-textnormal' can be used to control whether the special flag should be set for the text in the figure (default is `-textnormal'). `hpgl' HP plotter language `mf' Metafont `png' Portable network graphics `jpg' `jpeg' JPEG image `gif' GIF image `pbm' PBMplus `svg' Scalable vector graphics `pdf' Portable document format Other devices are supported by "convert" from ImageMagick. Type system("convert") to see what formats are available. If the device is omitted, it is inferred from the file extension, or if there is no filename it is sent to the printer as postscript. `-SXSIZE,YSIZE' Plot size in pixels for PNG and SVG. If using the command form of the print function, you must quote the XSIZE,YSIZE option. For example, by writing `"-S640,480"'. `-FFONTNAME' `-FFONTNAME:SIZE' `-F:SIZE' FONTNAME set the postscript font (for use with postscript, aifm, corel and fig). By default, 'Helvetica' is set for PS/Aifm, and 'SwitzerlandLight' for Corel. It can also be 'Times-Roman'. SIZE is given in points. FONTNAME is ignored for the fig device. The filename and options can be given in any order. /usr/local/octave-3.0.2/share/octave/3.0.2/m/plot/print.m Additional help for built-in functions and operators is available in the on-line 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:2> x=linspace(0,1,100) x = Columns 1 through 7: 0.00000 0.01010 0.02020 0.03030 0.04040 0.05051 0.06061 Columns 8 through 14: 0.07071 0.08081 0.09091 0.10101 0.11111 0.12121 0.13131 Columns 15 through 21: 0.14141 0.15152 0.16162 0.17172 0.18182 0.19192 0.20202 Columns 22 through 28: 0.21212 0.22222 0.23232 0.24242 0.25253 0.26263 0.27273 Columns 29 through 35: 0.28283 0.29293 0.30303 0.31313 0.32323 0.33333 0.34343 Columns 36 through 42: 0.35354 0.36364 0.37374 0.38384 0.39394 0.40404 0.41414 Columns 43 through 49: 0.42424 0.43434 0.44444 0.45455 0.46465 0.47475 0.48485 Columns 50 through 56: 0.49495 0.50505 0.51515 0.52525 0.53535 0.54545 0.55556 Columns 57 through 63: 0.56566 0.57576 0.58586 0.59596 0.60606 0.61616 0.62626 Columns 64 through 70: 0.63636 0.64646 0.65657 0.66667 0.67677 0.68687 0.69697 Columns 71 through 77: 0.70707 0.71717 0.72727 0.73737 0.74747 0.75758 0.76768 Columns 78 through 84: 0.77778 0.78788 0.79798 0.80808 0.81818 0.82828 0.83838 Columns 85 through 91: 0.84848 0.85859 0.86869 0.87879 0.88889 0.89899 0.90909 Columns 92 through 98: 0.91919 0.92929 0.93939 0.94949 0.95960 0.96970 0.97980 Columns 99 and 100: 0.98990 1.00000 octave:3> x=linspace(0,1,100); octave:4> plot(x,sin(x)) octave:5> x=linspace(-1,1,100); octave:6> plot(x,log(x)) octave:7> log(-1) ans = 0.00000 + 3.14159i octave:8> sin(pi) ans = 1.2246e-16 octave:9> ls 2008-11-13.txt.new derivataradice2.m horner.m newton.m radice2.m octave:10> pwd ans = /home/accounts/altri/caliari/aa0809/calcolo_numerico/equazioni octave:11> radice2(2) ans = 2 octave:12> radice2(3) ans = 7 octave:13> radice2(3,2) ans = 7 octave:14> radice2(3,3) ans = 25 octave:15> [y,iterazioni,stima]=newton(@radice2,@derivataradice2,2,1e-8,10) y = 1.4142 iterazioni = 4 stima = 1.5947e-12 octave:16> format long e octave:17> [y,iterazioni,stima]=newton(@radice2,@derivataradice2,2,1e-8,10) y = 1.41421356237469e+00 iterazioni = 4.00000000000000e+00 stima = 1.59474291028331e-12 octave:18> sqrt(2) ans = 1.41421356237310e+00 octave:19> [y,iter,stima]=newton(@radice2,@derivataradice2,2,1e-8,10,3) y = 1.25992104989539e+00 iter = 5.00000000000000e+00 stima = 5.21563417051984e-13 octave:20> 2^(1/3) ans = 1.25992104989487e+00 octave:21> quit