Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Tema nr.

2
N=7
Problema 1
octave-3.6.4.exe:1> q=0.015*7
q = 0.10500
octave-3.6.4.exe:2> pmx=(20.5+7)*9810
pmx = 269775
octave-3.6.4.exe:3> l=1000+10*7
l = 1070
octave-3.6.4.exe:4> function y=re(d,q)
> y=4/pi/0.000001.*q./d;
> endfunction
octave-3.6.4.exe:5> function y=la(d,q,k)
> y=1.3254./(log(0.5/3.72./d+5.74./(re(d,q).^0.9)).^2);
> endfunction
octave-3.6.4.exe:6> function y=dp(d,q,k,l)
> y=1000*9.81*0.0826.*la(d,q,k).*l./(d.^5).*(q.^2);
> endfunction
octave-3.6.4.exe:7> dp(0.6,0.105,0.5,1070)
ans = 7.2835e+004
octave-3.6.4.exe:8> dp(0.8,0.105,0.5,1070)
ans = 1.2161e+004
octave-3.6.4.exe:9> dd=0.6:0.001:0.8;
octave-3.6.4.exe:10> yy=dp(dd,0.105,0.5,1070);
octave-3.6.4.exe:11> plot(dd,yy)
octave-3.6.4.exe:12> function y=px(d)
> y=dp(d,0.105,0.5,1070)-269775;
> endfunction
octave-3.6.4.exe:13> [sol,info,msg]=fsolve("px",0.65)
sol = 0.48955
info = -0.032253
msg = 2

Problema 2
octave-3.6.4.exe:6> q=0.207
q = 0.20700
octave-3.6.4.exe:7> qc=q/4
qc = 0.051750
octave-3.6.4.exe:8> function y=debit(x)
> y(1)=0.207-x(1)-x(3);
> y(2)=x(1)-x(2)-x(4);
> y(3)=x(2)+x(5)-0.05175;
> y(4)=x(3)-x(6)-x(8)-0.05175;
> y(5)=x(4)+x(6)-x(7)-x(9)-0.05175;
> y(6)=x(7)-x(5);
> y(7)=x(8)-x(10);
> y(8)=x(1).^2+x(4).^2-x(6).^2-x(3).^2;
> y(9)=x(2).^2-x(5).^2-x(7).^2-x(4).^2;
> y(10)=x(6).^2+x(9).^2-x(10).^2-x(8).^2;
> endfunction
octave-3.6.4.exe:9> [x,info,msg]=fsolve("debit",[0.02 0.02 0.02 0.02 0.02 0.02>
x=
Columns 1 through 6:
0.0995322 0.0498037 0.1074678 0.0497285 0.0019463 0.0288144
Columns 7 through 10:

0.0019463 0.0269034 0.0248466 0.0269034


info =
Columns 1 through 6:
0.0000e+000 -6.9389e-018 6.9389e-018 6.9389e-018 2.0817e-017
0.0000e+000
Columns 7 through 10:
0.0000e+000 -2.7514e-008 -8.6519e-008 3.7987e-008
msg = 1
octave-3.6.4.exe:10> x(9)+x(10)
ans = 0.051750

Problema 3
octave-3.6.4.exe:1> x=[1 -1 1];
octave-3.6.4.exe:2> function y=jacobi(x)
> y(1)=(10-x(2)-x(3))/16;
> y(2)=log(8-x(1)+x(3))/log(16);
> y(3)=log(10-x(1)-x(2))/log(16);
> endfunction
octave-3.6.4.exe:3> x1=jacobi(x)
x1 =
0.62500 0.75000 0.83048
octave-3.6.4.exe:4> x2=jacobi(x1)
x2 =
0.52622 0.75915 0.77713
octave-3.6.4.exe:5> x3=jacobi(x2)
x3 =
0.52898 0.76114 0.78086
octave-3.6.4.exe:6> x4=jacobi(x3)
x4 =
0.52863 0.76118 0.78066
octave-3.6.4.exe:7> 16*0.52863+0.76118+0.78
ans = 9.9993
octave-3.6.4.exe:8> 0.52863+16^0.76118-0.78
ans = 8.0005
octave-3.6.4.exe:9> 0.52863+0.76118+16^0.78
ans = 9.9837
octave-3.6.4.exe:10> function y=jacobi(x)

> y(1)=(10-x(2)-x(3))/16;
> y(2)=log(-8-x(1)+x(3))/log(16);
> y(3)=log(10-x(1)-x(2))/log(16);
> endfunction
octave-3.6.4.exe:11> x1=jacobi(x)
x1 =
0.62500 + 0.00000i 0.75000 + 1.13309i 0.83048 + 0.00000i
octave-3.6.4.exe:12> x2=jacobi(x1)
x2 =
0.52622 - 0.07082i 0.74061 + 1.13309i 0.78022 - 0.04711i
octave-3.6.4.exe:13> x3=jacobi(x2)
x3 =
0.52995 - 0.06787i 0.73836 + 1.13199i 0.78427 - 0.04366i
octave-3.6.4.exe:14> x4=jacobi(x3)
x4 =
0.52984 - 0.06802i 0.73835 + 1.13196i 0.78422 - 0.04374i
octave-3.6.4.exe:15> function y=gs(x)
> y(1)=(10-x(2)-x(3))/16;
> y(2)=log(8-y(1)+x(3))/log(16);
> y(3)=log(10-y(1)-y(2))/log(16);
> endfunction
octave-3.6.4.exe:16> x1=gs(x)
x1 =
0.62500 0.76652 0.77644
octave-3.6.4.exe:17> x2=gs(x1)
x2 =
0.52856 0.76101 0.78069
octave-3.6.4.exe:18> x3=gs(x2)
x3 =
0.52864 0.76119 0.78068
octave-3.6.4.exe:19> x4=gs(x3)
x4 =
0.52863 0.76119 0.78068

Problema 4
octave:89> function y=newton(x)

> y(1)=x(1)-(x(1)^3+x(2)^3-2)/(3*x(1)^2);
> y(2)=x(2)-(y(1)*x(2)+y(1)+x(2)-3)/(y(1)+1);
> endfunction
octave:90> x1=newton(x)
x1 =
1.59388 0.54209
octave:91> x2=newton(x1)
x2 =
1.30410 0.73603
octave:92> x3=newton(x2)
x3 =
1.18325 0.83213
octave:93> x4=newton(x3)
x4 =
1.12781 0.87987

You might also like