Example: marketing

# Scilab 超入門 - infsup.jp

Scilab .. 2015 4 22 .. Scilab 1990 INRIA. *1 ENPC *2 1 2. 2003 5 Scilab . 2 2. INRIA .. 2.. 2.. 3.. 3. MATLAB .. 4. MATLAB . ( 3 4. Scilab ) .. 4. URL .. 5.. 6. Scilab .. 7. Scilab .. 7. hirokawa/. Scilab / 4 2D 8. MATLAB/ Scilab .. 8. 2003 3,045 .. 8. A. Quarteroni, F. Saleri, P. Gervasio Scientific .. 9. Computing with MATLAB and Octave, 4th edit., .. 10. Springer, 2014 MATLAB . Octave 2014 5 10. Scilab 6 for 12.. 7 if 13. Web . Scilab . 8 Fourier 14. Quarteroni MATLAB. 9 15.. 15.. 15. 10 3D 15.. 15. norikazu[at] *1.. 16. *2 .. 17. 1. 1 --> cd '~/WORK/1lectures/ Scilab /'. Scilab 1 ans =. Scilab *3 /Users/norikazu/WORK/1lectures/ Scilab --> pwd ans =. /Users/norikazu/WORK/1lectures/ Scilab 2 .. 1 Scilab .. --> 3 + 4. ans =. 7. --> 3 - 4. ans =. - 1. --> 3 + (-4). ans =. - 1. --> 3 * 4. ans =. 12. 2 Scilab . --> 3/4. ans =. Scilab --> 2 + 3 [enter/return] 5 --> 3^4.

Scilab 超入門 齊藤宣一 2015年4月22日 ウィキペディアでは次のように説明されている： Scilab（サイラボ）とは，1990年からフランスのINRIA

### Information

Domain:

Source:

Please notify us if you found a problem with this document:

### Transcription of Scilab 超入門 - infsup.jp

1 Scilab .. 2015 4 22 .. Scilab 1990 INRIA. *1 ENPC *2 1 2. 2003 5 Scilab . 2 2. INRIA .. 2.. 2.. 3.. 3. MATLAB .. 4. MATLAB . ( 3 4. Scilab ) .. 4. URL .. 5.. 6. Scilab .. 7. Scilab .. 7. hirokawa/. Scilab / 4 2D 8. MATLAB/ Scilab .. 8. 2003 3,045 .. 8. A. Quarteroni, F. Saleri, P. Gervasio Scientific .. 9. Computing with MATLAB and Octave, 4th edit., .. 10. Springer, 2014 MATLAB . Octave 2014 5 10. Scilab 6 for 12.. 7 if 13. Web . Scilab . 8 Fourier 14. Quarteroni MATLAB. 9 15.. 15.. 15. 10 3D 15.. 15. norikazu[at] *1.. 16. *2 .. 17. 1. 1 --> cd '~/WORK/1lectures/ Scilab /'. Scilab 1 ans =. Scilab *3 /Users/norikazu/WORK/1lectures/ Scilab --> pwd ans =. /Users/norikazu/WORK/1lectures/ Scilab 2 .. 1 Scilab .. --> 3 + 4. ans =. 7. --> 3 - 4. ans =. - 1. --> 3 + (-4). ans =. - 1. --> 3 * 4. ans =. 12. 2 Scilab . --> 3/4. ans =. Scilab --> 2 + 3 [enter/return] 5 --> 3^4.

2 Ans =. 81. --> 2 + 3 [enter/return] --> 4^(-2). ans = ans =. 5. [enter/return] .. --> %pi %pi =. -->3*%pi ans =. *3 ECCS Mac OS .. 2.. --> 2 + 3*%i . ans = format 15. 2. + 20 15 15 . -->(2 + 3*%i)*(2 - 3*%i) D+00 100 . ans =. 13. --> x = *%pi -->%e x =. %e = +00. --> format("v",15);. --> x x =. |x| abs(x) --> format("v",20);.. x sqrt(x) --> x x e exp(x) x =. log x log(x) log10 x log10(x) --> format("e",15);. sin x sin(x) --> x 1. acos x = cos x acos(x) x =. tanh x tanh(x) +00. int(x) --> format("e",20);. a/b modulo(a, b) --> x z = re [ , ). i . atan2(z) x =. +00. // . --> sin(10*%pi)+2*cos(3*%pi) Scilab . ans = . - 2. Scilab . // int16. --> modulo(7, 4) . ans =. 3. --> format("v",10);. // . --> n = 1. --> int(7/4). n =. ans =. 1. 1. --> m = int16(1). m =.. 1. --> format("e",20);. // --> n n =. +00. --> m 3. m = 5. 1 6. --> w = [7; 8; 9]. w =.]

3 7. 8. --> who 9. // . --> A'. 3 ans =. 3. 1. 1.. - 1. 4. 1.. 0. 2. 3. [ ] , ; . --> u'.. ans =. 1. // 2. --> A = [3, -1, 0; 1, 4, 2; 1, 1, 3] 3. A = --> v'. 3. - 1. 0. ans =. 1. 4. 2. 4. 5. 6. 1. 1. 3. // . --> B = [-2, 2, 5; 1, 3, 4; 1, -1, 2] --> A*v B = ans =. - 2. 2. 5. 7. 1. 3. 4. 36. 1. - 1. 2. 27. // --> u*v --> 4*A - 2*B ans =. ans = 32. 16. - 8. - 10. -->u*u'. 2. 10. 0. ans =. 2. 6. 8. 14. --> A*B. ans =.. - 7. 3. 11. 4. 12. 25. 2. 2. 15. [a: h: b]. // . --> u = [1, 2, 3] [a, a+h, a+2h, .., b-h, b] . u = . 1. 2. 3. --> v = [4, 5, 6]' --> x=[1 :3]'. v = x =. 4. 1. 4. --> A = [3, -1, 0; 1, 4, 2; 1, 1, 3];. 2. --> B = [-2, 2, 5; 1, 3, 4; 1, -1, 2];. // . 3. // 2 . --> x=[1 :2]' --> norm(x, 2). x = ans =. 1. --> norm(y, 2). ans =. // 1 . --> norm(x, 1). ans =. 6. // infty . --> norm(y, %inf). 2. ans =. 6. // . --> norm(A, 2). ans =. linspace(a, b, n).

4 --> norm(A, 1).. ans =. 6. --> linspace(0, 1, 5) --> norm(A, %inf). ans = ans =. 0. 1. 7. --> norm(A). --> linspace(0, 1, 8)' ans =. ans = 0. // . --> det(A), det(B). ans =. 31. ans =. - 36. // . 1. --> A^(-1). ans =. - - - - - --> x = [1,2,3]';. --> inv(A). --> y = [4,5,6];. ans =. 5. - // . - - --> rand(2,3). - - ans =. ; --> rand(2,3). ans =. --> x = [1,2,3]'. x =. 1. 2. A A . 3. A . --> x = [1,2,3]'; . --> A=[1,2;3,4];. --> eye(A). ans =. // . 1. 0. --> eye(3, 3). 0. 1. ans =. --> zeros(A). 1. 0. 0. ans =. 0. 1. 0. 0. 0. 0. 0. 1. 0. 0. --> eye(4, 3). //. ans =. -->A=[1,2,3,4;5,6,7,8];. 1. 0. 0. -->eye(A). 0. 1. 0. ans =. 0. 0. 1. 1. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. // 1 . --> ones(2,3). ans = . 1. 1. 1. 1. 1. 1. --> u = [1, 2, 3]. --> ones(3,3) u =. ans = 1. 2. 3. 1. 1. 1. --> A = [1,2,3;4,5,6;7,8,9]. 1. 1. 1. A =. 1. 1. 1. 1. 2. 3. // 4.

5 5. 6. --> zeros(3,4) 7. 8. 9. ans = // . 0. 0. 0. 0. --> diag(u). 0. 0. 0. 0. ans =. 0. 0. 0. 0. 1. 0. 0. 6. 0. 2. 0.. 0. 0. 3. A = (aij ) Rn n B = (bij ) Rn n . --> diag(diag(A)) .. ans = a11 b11 a12 b12 a1n b1n a21 b21 a22 b22 a2n b2n . 1. 0. 0.. A B = .. , 0. 5. 0.. 0. 0. 9. an1 bn1 an2 bn2 ann bnn // . --> tril(A) . am 11 am 12 am 1n ans = am am am . 21 22 2n . A A A = .. , 1. 0. 0. | {z } .. m . 4. 5. 0. am n1 am n2 am nn 7. 8. 9.. --> tril(A, 1) . a11 /b11 a12 /b12 a1n /b1n ans = a21 /b21. a22 /b22 a2n /b2n .. 1. 2. 0. A (1/bij ) = .. 4. 5. 6. an1 /bn1 an2 /bn2 ann /bnn 7. 8. 9. 3D . --> tril(A, -1).. ans =. 0. 0. 0. 4. 0. 0. -->A = [3, -1, 0; 1, 4, 2; 1, 1, 3];. 7. 8. 0. -->B = [-2, 2, 5; 1, 3, 4; 1, -1, 2];. // --> A.*B. --> triu(A) ans =. ans = - 6. - 2. 0. 1. 2. 3. 1. 12. 8. 0. 5. 6. 1. - 1. 6. 0. 0. 9. -->A.^2. --> triu(A, 1) ans =.

6 Ans = 9. 1. 0. 0. 2. 3. 1. 16. 4. 0. 0. 6. 1. 1. 9. 0. 0. 0. --> --> triu(A, -1) ans =. ans = - - 0. 1. 2. 3. 1. 4. 5. 6. 1. - 1. 0. 8. 9.. --> u = [1, 2, 3]'. u =. 1. 2. 7. 3. --> v = [4, 5, 6]'. v =. 4. 5. 6. --> X = [u, v]. X =. 1. 4. 2. 5. 3. 6. 3. --> w = [u ; v]. w =. 1. x y . 2.. 3.. 4.. 5. 6. --> x = linspace(0, 2*%pi, 20);. --> z = X(:). --> y = sin(x);. z =. --> plot2d(x, y). 1. 2. 3.. 4.. 5. 6. --> x = linspace(0, 2*%pi, 100)';. -->u = [u, v, v, u] --> y = sin(x);. u = --> plot2d(x, y);. 1. 4. 4. 1. --> y = sin( *x);. 2. 5. 5. 2. --> plot2d(x, y). 3. 6. 6. 3. 4 2D .. 0 x y = sin x . x [0, 2 ] 20 1 . x . x y sin x . plot2d . --> x = linspace(0, 2*%pi, 20)';. --> y = sin(x);. --> plot2d(x, y) 4. 8.. --> x = linspace(0, 2*%pi, 100)';. 5 --> y1 = sin(x);. --> y2 = sin( *x);. --> plot2d(x, [y1, y2]);. --> x = linspace(0, 2*%pi, 100)'.

7 --> y = sin(x);. --> plot2d(x, y, style = 5);. --> y = sin( *x);. --> plot2d(x, y, style = 2);. 6.. 5 . 5. --> x = linspace(0, 2*%pi, 100)';. style --> y1 = sin(x);. --> y2 = sin( *x);.. --> plot2d(x, [y1, y2], style=[5,2]);. 1 5 . 2 6 .. 3 7 . 7 .. 4 . RGB . --> x = linspace(0, 2*%pi, 100)';. color(r, g, b) r g b . --> y1 = sin(x);. 0 255 . --> y2 = sin( *x);. --> plot2d(x, [y1, y2], style=[5,2]);. --> plot2d(x, y, style = color(255, 224, 224)); // . -->xgrid();. // . 6 // (1: ) (2: ) (3: ) (4: ). --> legend("sin(x)", "sin(3x)", 1);. 100 x y1 y2 100 2 // . [y1, y2] plot2d --> title(" ");. plot2d (x, y1) (x, y2) --> xlabel("x");. --> ylabel("y");. // . 9. --> xtitle(" ","x","y");. 8 . --> xs2eps(0, " "). 7 . 0, 1, 2, .. Scilab --> scf(4); // 4 .. --> plot2d(x, y). > .. 8 .. Save As: fig1. Save As: . File Format: PDF .. Save As: fig1. Save As.

8 File Format: 9. (EPS).. 5 . 0 . f (x) = e x + x2 sin(3x) .. --> xs2pdf(0, " ") --> x = linspace(0, 2*%pi, 100)';. --> y = exp(-x) + (x.^2).*sin(3*x);. 10. --> plot2d(x, y). 9 . f (x) .. 10 SciNotes Scilab . 11 Scilab . --> scinotes 12 . Prog 11 . Prog . // 1. function y = func1(x). y=exp(-x)+(x.^2).*sin( *x);. endfunction 13 .. 12 . 13 . 10 SciNotes . --> x = linspace(0, 2*%pi, 100)';. --> y = func1(x);. --> plot2d(x, y). F5 .. // . --> exec(" ");. // . --> x = linspace(0, 2*%pi, 100)';. 11 SciNotes --> y = func1(x);. --> plot2d(x, y). 11. func1 Prog endfunction . // 1 + 1/2 + 1/3 + .. + 1/n function wa = sumfrac1(n). wa = ;. Prog 1 for i=1:n // 1 wa = wa + (i);. function y = func1(x) end y=exp( *x)+(x.^2).*sin( *x); endfunction endfunction // 1 + 1/(2^2) + 1/(3^2) + .. + 1/(n^2). function wa = sumfrac2(n). wa = ;. for i=1:n wa = wa + (i*i).

9 -->exec(" "); end endfunction : : func1, funcprot( ) .. // . --> exec(" ");. // . Prog --> summation1(5). ans =. Prog . 15. // 1. function y = func1(x). --> summation2(10). y=exp( *x)+(x.^2).*sin( *x); ans =. endfunction 385. // 2. function y = func2(x) --> sumfrac1(10). y=exp(x)-2*x-1 ans =. endfunction --> sumfrac2(35). 6 for ans =. Scilab (sub-program) . Prog . Prog .. function = ( ). Prog . // 1 + 2 + 3 + .. + n endfunction function wa = summation1(n) . wa = ;. for i=1:n summation1(n) . wa = wa + i;. end wa = ;. endfunction for i=1:n // 1 + 2^2 + 3^2 + .. + n^2 wa = wa + i;. function wa = summation2(n) end wa = ;. for i=1:n for . wa = wa + i*i;. end . 12. for . function [xvect, fx, xdif] = bisec1(a, b, ep, fun). for i=1:n // . kmax = ( ( ))*log((b-a)/ep) + 1;. ( ). // 0 . end xvect=[]; fx=[]; xdif=[];. // . i=1 ( ) for k = 1:kmax // ek = (bk-ak)/2.

10 I=2 ( ) xdif = [xdif ; *abs(b - a)];. i=n ( ) for // xk=c=(b+a)/2 f(xk)=f(c) . c = (a + b)/2; x = c; fc = fun(x);. summation1(10) xvect = [xvect ; x]; fx = [fx ; fc];. i=1 wa= + i=2 x = a;. // . wa= + + i=10 if fc*fun(x)>= wa= + + +..+ wa a=c;. else . b=c;. end // if . 7 if end // for . endfunction . f (x) = ex 2x 1. bisec1(a, b, ep, fun) a, b, ep, fun . a = 0 b = 0 ep = func = f (x) = ex 2x 1. f (a) = ea 2a 1 = 0.. a if . 1 < a < 2 f (1) < 0 f (2) > 0 . if . (bisection method) if ( ). [ 0 , 0 ] = [1, 2] ( ). end k 0 . ( ) ( ) . 1. xk = ( k + k ), . { 2. if . [ k , xk ] (f (xk )f ( k ) 0 ). [ k+1 , k+1 ] =. [xk , k ] (f (xk )f ( k ) < 0 ) if ( ). ( 1).. else ( )k+1. 1 ( 2). |xk a| k k = ( 0 0 ). 2 end . |xk a| . 1 | | ( ) . k = log . log 2 ( 1) ( 2).. Scilab Prog . ( ) .. a b a>=b Prog . a b a<=b // . // [a, b] ep a>b a>b // fun (function ) a<b a<b // xvect = [x1, x2.]}