Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1
- cos(tan(100+2.5*exp(1))-7.283)*0.51/(5+sin(8))
- 2
- s=((2*3+3*19)/2)*20
- 3.1
- for i=-2:0.1:-1
- tan(7*i)
- end
- 3.2
- for i=1.5:0.02:2.8
- tan(7*i)
- end
- 4.1
- A=zeros(3,4)
- B=ones(4,5)
- A(:,1)=A(:,1)+5
- A(:,2)=A(:,2)+6
- A(2,:)=A(2,:)+1
- A(3,:)=A(3,:)+7
- A(3,4)=-1
- 4.2
- A=zeros(3,4)
- B=ones(4,5)
- C=eye(4,5)
- B=B+C
- B(2,:)=B(2,:)-2
- B(:,2)=B(:,2)*3
- B(5,3)=0
- B(5,2)=0
- 4.3
- clc
- A=[2 3; 1 2]
- B=[11 12; 14 1]
- C=A*B
- C=B*A
- A.*B
- 6
- clc
- function [t] = F(a,b)
- rand("uniform");
- t=0;
- for j=1:1:1000
- k = rand(1,1);
- if k<a | k>b then
- t=t+1;
- end
- end
- endfunction
- 7
- function [prime] = F(n);
- x=1;
- i=1;
- p=1;
- prime = [1,1];
- prove = 1;
- while i<=n
- for j=2:1:p
- if (pmodulo(p,j) == 0 & p <> j) then
- prove = 0
- end
- end
- if (prove == 1) then
- prime(1,i) = p
- i=i+1
- end
- p=p+1
- prove = 1
- end
- endfunction
- 8
- function [ruts] = F(n,m,f,d);
- ruts = roots(poly([n,m,f,d], 'x' , 'c'))
- endfunction
- 9
- alr=[1,2,2;
- 1,2,1;
- 1,1,2;
- 1,1,1];
- [alr1,k]=gsort(alr,'lr','i')
- [alr1,k]=gsort(alr,'lc','i')
- 2й блок
- clc
- // x=-%pi:0.05:%pi
- // plot2d(x,3*cos(x), style = color('blue'),leg = 'Функция 3*cos(x)')
- //g.x_label.text='Ось абсцисс';
- //g.y_label.text='Ось ординат';
- //g.children(1).children.line_style=6;
- //g.grid=[0 0];
- t=1:0.01:10
- x=t^2+3
- y=t+1
- plot2d(x,y)
- 3й блок
- 1
- A = [6 -8 1; 3 2 -3; 7 -1 5]
- b = [5;-2;3]
- C = rref([A b])
- [n,m] = size(C);
- x = C(:,m)
- A = [1 2 3; 4 5 6; 7 8 9]
- b = [1;2;3]
- C = rref([A b])
- [n,m] = size(C);
- x = C(:,m)
- 2.1
- function [angle] = U(V1,V2)
- angle = acos((V1(1)*V2(1)+V1(2)*V2(2)+V1(3)*V2(3))/(sqrt(V1(1)^2+V1(2)^2+V1(3)^2)*sqrt(V2(1)^2+V2(2)^2+V2(3)^2)))
- endfunction
- 2.2
- function [len] = F(V);
- len = sqrt(V(1)^2+V(2)^2+V(3)^2);
- endfunction
- 3
- C = [1,2,5]'
- R = [0,4,2]
- angle = U(C,R)
- Oy = [0,1,0]
- angle = U(2*C'+R,Oy)
- 4
- function F = G(n);
- F = [1,1]
- F(1) = 1;
- F(2) = 1;
- S = 2;
- for i=2:1:n-1
- F(i+1) = F(i)+F(i-1);
- S = S+F(i+1);
- end
- F(n+1) = S;
- endfunction
- 5
- function seq = F(n)
- seq = [1,1]
- seq(1) = 1;
- seq(2) = 1;
- for i = 2:1:n-1
- seq(i+1) = 2*seq(i);
- end
- endfunction
- 6
- 7
- V = [3,1,-8,-3,5; 3,5,2,1,1;1,2,-5,3,1]
- W = [1,1,1,1,1;-1,4,2,10,3;-3,-1,5,0,2]
- spaninter(V,W)
- 8
- 9
- X = 0:0.05:2*%pi;
- Y = X.*sin(X);
- function y =f(x), y = x.*sin(x), endfunction
- I = intg(0,2*%pi,f)
- plot2d(X,Y)
- 11
- deff('y=f(x)','y = 5-2*x-1/x')
- x1 = fsolve(0.3,f);
- x2 = fsolve(2.3,f);
- X= x1:0.01:x2;
- Y = 5-2*X;
- plot2d(X,Y)
- Y =(X).^(-1);
- plot2d(X,Y)
- function y = g(x), y = 5-2*x, endfunction
- function y = h(x), y = 1/x, endfunction
- I = intg(x1,x2,g)-intg(x1,x2,h)
- 12
- x=-10:0.1:10
- y=2*x^2-3*x+1
- plot2d(x,y, style = color('blue'))
- y=(25-(x-3)^2)^(1/2)+1
- plot2d(x,y, style = color('blue'))
- y=-(25-(x-3)^2)^(1/2)+1
- plot2d(x,y, style = color('blue'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement