From 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Tue, 10 Oct 2017 12:27:19 +0530 Subject: initial commit / add all books --- 260/CH9/EX9.1/9_1.sce | 8 ++++++ 260/CH9/EX9.2/9_2.sce | 14 ++++++++++ 260/CH9/EX9.3/9_3.sce | 56 +++++++++++++++++++++++++++++++++++++ 260/CH9/EX9.4/9_4.sce | 18 ++++++++++++ 260/CH9/EX9.5/9_5.sce | 35 ++++++++++++++++++++++++ 260/CH9/EX9.6/9_6.sce | 14 ++++++++++ 260/CH9/EX9.7/9_7.sce | 21 ++++++++++++++ 260/CH9/EX9.8/9_8.sce | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 242 insertions(+) create mode 100644 260/CH9/EX9.1/9_1.sce create mode 100644 260/CH9/EX9.2/9_2.sce create mode 100644 260/CH9/EX9.3/9_3.sce create mode 100644 260/CH9/EX9.4/9_4.sce create mode 100644 260/CH9/EX9.5/9_5.sce create mode 100644 260/CH9/EX9.6/9_6.sce create mode 100644 260/CH9/EX9.7/9_7.sce create mode 100644 260/CH9/EX9.8/9_8.sce (limited to '260/CH9') diff --git a/260/CH9/EX9.1/9_1.sce b/260/CH9/EX9.1/9_1.sce new file mode 100644 index 000000000..3f7f3c85e --- /dev/null +++ b/260/CH9/EX9.1/9_1.sce @@ -0,0 +1,8 @@ +//Eg-9.1 +//pg-386 + +clear +clc + +//Theoretical Problem +disp("given example is Theoretical") \ No newline at end of file diff --git a/260/CH9/EX9.2/9_2.sce b/260/CH9/EX9.2/9_2.sce new file mode 100644 index 000000000..958135b3a --- /dev/null +++ b/260/CH9/EX9.2/9_2.sce @@ -0,0 +1,14 @@ +//Eg-9.2 +//pg-387 + +clear +clc + + +//zeros of T3(x) +n=3; +for i=1:3 + lambda(i)=cosd((2*i-1)*180/(2*n)); +end +disp("zeros of T3(x)") +disp(lambda) \ No newline at end of file diff --git a/260/CH9/EX9.3/9_3.sce b/260/CH9/EX9.3/9_3.sce new file mode 100644 index 000000000..8928547ee --- /dev/null +++ b/260/CH9/EX9.3/9_3.sce @@ -0,0 +1,56 @@ +//Eg-9.2 +//pg-388 + +clear +clc + +a=[1 0 -1 1]; +fz=poly(a,'z','c'); +r=roots(fz); + + +//bounds +lb=1; +ub=3; +//using x=2z-b-a/b-a ---using fact that x=z-2 fx roots are obtained from subtracting 2 from fz +s=r-2; + +fx=poly(s,'x',['roots']); +disp(fx) +m=coeff(fx); + +for i=1:4 + t0=m(1)*1+1/2*m(3); + t1=m(2)*1+3/4*m(4); + t2=1/2*m(3); + t3=1/4*m(4); + +end + +//considering order greater than 1 +fx1=poly([t0 t1],'x','c'); +r=roots(fx1); +s=r+2; +fz1=poly(s,'z',['roots']); +fz2=35/4*fz1; + + + +error1=fz-fz2; + +//order>2 +f2z=poly([15/2 -45/4 5],'z','c'); +error2=fz-f2z; + + +//plotting f vs z +z=.5:.5:3.5; +plot(z,horner(fz,z)); +set(gca(),"auto_clear","off") +plot(z,horner(fz2,z)); +plot(z,horner(f2z,z)); + + +//errors e vs z +plot(z,horner(error1,z)); +plot(z,horner(error2,z)); \ No newline at end of file diff --git a/260/CH9/EX9.4/9_4.sce b/260/CH9/EX9.4/9_4.sce new file mode 100644 index 000000000..bc8e7b295 --- /dev/null +++ b/260/CH9/EX9.4/9_4.sce @@ -0,0 +1,18 @@ + +//Eg-9.4 +//pg-394 + +clear +clc +clc; +clear; + +deff('[z]=f(x)','z=(x^4-2*x^2)*sin(x)'); +x1=-1:.2:1; +//values of fx obtained manually + +fx1=[.841471;0.624387;.333365;.114645;.015576;0;-.015576;-.114645;-.333365;-.624387;-.841471]; + +plot(x1,feval(x1,f)); +set(gca(),"auto_clear","off") +plot(x1,fx1,'*'); diff --git a/260/CH9/EX9.5/9_5.sce b/260/CH9/EX9.5/9_5.sce new file mode 100644 index 000000000..94ca8b44e --- /dev/null +++ b/260/CH9/EX9.5/9_5.sce @@ -0,0 +1,35 @@ +//Eg-9.4 +//pg-396 + +clc +clear + +//from mclaurins series +a=[0 1 0 -1/3 0 1/5 0 -1/7 0 1/9]; + + +//from R5,4x +//subracting fx r45x and sloving for coefficients we end up with the matrices +A=[1 0 -1.6667 0;0 1 0 -1.66667;-0.71429 0 1 0;0 -.71429 0 1]; +C=[0;0.71429;0;-.55556]; + +B=inv(A)*C; +//using these values we can compute values of a we represent set of a values using matrix P + +P(1)=0; +P(2)=1; +P(3)=B(1); +P(4)=B(2)-1/3; +P(5)=B(3)-B(1)/3; +P(6)=B(4)-B(2)/3+1/5; + +T(1) = 1; +for(i = 1:4) + T(i+1) = B(i); +end + +j=poly(P,"x","coeff"); +k=poly(T,"x","coeff"); + +disp("so required R5,4x is") +disp(j/k) \ No newline at end of file diff --git a/260/CH9/EX9.6/9_6.sce b/260/CH9/EX9.6/9_6.sce new file mode 100644 index 000000000..da872b020 --- /dev/null +++ b/260/CH9/EX9.6/9_6.sce @@ -0,0 +1,14 @@ +//Eg-9.6 +//pg-400 + +clc +clear + +x=0.6; +p=.3275911; +t=1/(1+p*x); + +erfx=1-(.254829592*t-.284496736*t^2+1.421413741*t^3-1.453152027*t^4+1.061405429*t^5)*exp(-x^2); + +disp("erf(.6)") +disp(erfx) \ No newline at end of file diff --git a/260/CH9/EX9.7/9_7.sce b/260/CH9/EX9.7/9_7.sce new file mode 100644 index 000000000..28ed4015f --- /dev/null +++ b/260/CH9/EX9.7/9_7.sce @@ -0,0 +1,21 @@ +//Eg-9.7 +//pg-403 + +clc +clear + +p=6.5; +n = 6; +a = 0.5; +prodd=1; + +for i = 1:n + prodd = prodd*(p-i); +end + +req=prodd*(22/7)^.5 + +disp("required value") +disp(req) + +printf('\n\n The minor difference in the answer is because of using the value of 22/7 in the place of pi\n') \ No newline at end of file diff --git a/260/CH9/EX9.8/9_8.sce b/260/CH9/EX9.8/9_8.sce new file mode 100644 index 000000000..15ab8d773 --- /dev/null +++ b/260/CH9/EX9.8/9_8.sce @@ -0,0 +1,76 @@ +//Eg-9.8 +//pg-413 + +clc +clear + +//After substituting alpha=lamda*R,z/L,r/R,L/R +//Treq=T-Ta/T0-Ta +//first three zeros are taken from appendix 9F + + +alpha=[2.4048;5.5201;8.6537]; + +a=[1;-2.2499997;1.2656208;-.3163866;.0444479;-.0039444;.00021]; +b=[.5;-.56249985;.21093573;-.03954289;.00443319;-.00031761;.00001109]; +c=[.36746691;.60559366;-.74350384;.25300117;-.04261214;.00427916;-.00024846]; +d=[-.6366198;.2212091;2.1682709;-1.31164827;.3123951;-.0400976;.0027873]; +e=[0.79788456;-.00000077;-.0055274;-.00009512;.00137237;-.00072805;.000014476]; +f=[.79788456;.00000156;.01659667;.00017105;-.00249511;.00113653;-.00020033]; +g=[-.78539816;-.04166397;-.00003954;.00262573;.00054125;-.00029333;.00013558]; +h=[-2.35619449;.12499612;.0000565;-.00637879;.00074348;.00079824;-.00029166]; + + +for i=1:3 + +x=alpha(i); + +p=x/3*x/3; +q=3/x; + +if x<3 then + J0(i)=a(1)+p*(a(2)+p*(a(3)+p*(a(4)+p*(a(5)+p*(a(6)+p*(a(7))))))) ; + J1(i)=x*(b(1)+p*(b(2)+p*(b(3)+p*(b(4)+p*(b(5)+p*(b(6)+p*(b(7)))))))) ; +else + f0=e(1)+q*(e(2)+q*(e(3)+q*(e(4)+q*(e(5)+q*(e(6)+q*(e(7))))))); + f1=f(1)+q*(f(2)+q*(f(3)+q*(f(4)+q*(f(5)+q*(f(6)+q*(f(7))))))) ; + theta0=x+g(1)+q*(g(2)+q*(g(3)+q*(g(4)+q*(g(5)+q*(g(6)+q*(g(7))))))) ; + theta1=x+h(1)+q*(h(2)+q*(h(3)+q*(h(4)+q*(h(5)+q*(h(6)+q*(h(7))))))) ; + J0(i)=(1/x)^.5*f0*cos(theta0); + J1(i)=(1/x)^.5*f1*cos(theta1); +end + +end +for i=1:3 + +x=alpha(i)/2; + +p=x/3*x/3; +q=3/x; + +if x<3 then + JJ0(i)=a(1)+p*(a(2)+p*(a(3)+p*(a(4)+p*(a(5)+p*(a(6)+p*(a(7))))))) ; + JJ1(i)=x*(b(1)+p*(b(2)+p*(b(3)+p*(b(4)+p*(b(5)+p*(b(6)+p*(b(7)))))))) ; +else + f0=e(1)+q*(e(2)+q*(e(3)+q*(e(4)+q*(e(5)+q*(e(6)+q*(e(7))))))); + f1=f(1)+q*(f(2)+q*(f(3)+q*(f(4)+q*(f(5)+q*(f(6)+q*(f(7))))))) ; + theta0=x+g(1)+q*(g(2)+q*(g(3)+q*(g(4)+q*(g(5)+q*(g(6)+q*(g(7))))))) ; + theta1=x+h(1)+q*(h(2)+q*(h(3)+q*(h(4)+q*(h(5)+q*(h(6)+q*(h(7))))))) ; + JJ0(i)=(1/x)^.5*f0*cos(theta0); + JJ1(i)=(1/x)^.5*f1*cos(theta1); +end + +end + +Treq=0; + +for i=1:3 +Treq=(1/alpha(i)*JJ0(i)*sinh(.5*alpha(i))/J1(i)/sinh(2*alpha(i)))+Treq; +end +Tfinal=2*Treq; +disp("values of alpha ,required bessel functions and final required value are respectively") +disp(alpha) +disp(JJ0) +disp(J1) +disp(Tfinal) + -- cgit