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 --- 1553/CH7/EX7.1/7Ex1.sce | 22 ++++++++++++++++++++++ 1553/CH7/EX7.10/7Ex10.sce | 19 +++++++++++++++++++ 1553/CH7/EX7.11/7Ex11.sce | 14 ++++++++++++++ 1553/CH7/EX7.12/7Ex12.sce | 22 ++++++++++++++++++++++ 1553/CH7/EX7.13/7Ex13.sce | 19 +++++++++++++++++++ 1553/CH7/EX7.14/7Ex14.sce | 10 ++++++++++ 1553/CH7/EX7.2/7Ex2.sce | 20 ++++++++++++++++++++ 1553/CH7/EX7.3/7Ex3.sce | 11 +++++++++++ 1553/CH7/EX7.4/7Ex4.sce | 21 +++++++++++++++++++++ 1553/CH7/EX7.5/7Ex5.sce | 20 ++++++++++++++++++++ 1553/CH7/EX7.6/7Ex6.sce | 17 +++++++++++++++++ 1553/CH7/EX7.7/7Ex7.sce | 10 ++++++++++ 1553/CH7/EX7.8/7Ex8.sce | 15 +++++++++++++++ 1553/CH7/EX7.9/7Ex9.sce | 16 ++++++++++++++++ 14 files changed, 236 insertions(+) create mode 100644 1553/CH7/EX7.1/7Ex1.sce create mode 100644 1553/CH7/EX7.10/7Ex10.sce create mode 100644 1553/CH7/EX7.11/7Ex11.sce create mode 100644 1553/CH7/EX7.12/7Ex12.sce create mode 100644 1553/CH7/EX7.13/7Ex13.sce create mode 100644 1553/CH7/EX7.14/7Ex14.sce create mode 100644 1553/CH7/EX7.2/7Ex2.sce create mode 100644 1553/CH7/EX7.3/7Ex3.sce create mode 100644 1553/CH7/EX7.4/7Ex4.sce create mode 100644 1553/CH7/EX7.5/7Ex5.sce create mode 100644 1553/CH7/EX7.6/7Ex6.sce create mode 100644 1553/CH7/EX7.7/7Ex7.sce create mode 100644 1553/CH7/EX7.8/7Ex8.sce create mode 100644 1553/CH7/EX7.9/7Ex9.sce (limited to '1553/CH7') diff --git a/1553/CH7/EX7.1/7Ex1.sce b/1553/CH7/EX7.1/7Ex1.sce new file mode 100644 index 000000000..321f1365d --- /dev/null +++ b/1553/CH7/EX7.1/7Ex1.sce @@ -0,0 +1,22 @@ +//Chapter 7 Ex1 + +clc; +clear; +close; +//let number be x +//given x-36=86-x +//thus polynomial is: 2x-122=0 + +mycoeff=[-122 2]; +p=poly(mycoeff,"x","coeff"); +ans=roots(p); +printf("The number is %d",ans); + + +//Alternative logic for same problem +for x=1:99 + if((2*x-122)==0) + printf("\nAlternate Logic: \nThe number is: %d",x); + break; +end +end diff --git a/1553/CH7/EX7.10/7Ex10.sce b/1553/CH7/EX7.10/7Ex10.sce new file mode 100644 index 000000000..9ea4b3d54 --- /dev/null +++ b/1553/CH7/EX7.10/7Ex10.sce @@ -0,0 +1,19 @@ +//Chapter 7 Ex10 +clc; +clear; +close; +//let numbers be x and y + +x=poly(0,'x'); +y=(3*x-5)/4; //equation 1 +y=(5*x+6)/7; //equation 2 +for x=1:99 + if((3*x-5)/4 ==(5*x+6)/7) + mprintf("x=%i \n ",x) + break + end +end +disp("substitute the x value in any one of the above equations to find y."); +y=(5*x+6)/7; +printf("\n The numbers are : %d and %d",x,y); + diff --git a/1553/CH7/EX7.11/7Ex11.sce b/1553/CH7/EX7.11/7Ex11.sce new file mode 100644 index 000000000..b61655940 --- /dev/null +++ b/1553/CH7/EX7.11/7Ex11.sce @@ -0,0 +1,14 @@ +//Chapter 7 Ex11 + +clc; +close; + +//let tens's digit be x and unit's be x+3 +//given number=10x+(x+3)=11x+3 +//ratio is (11x+3)/(2x+3)=4/1 +//polynomial is: 3x-9=0 + + mycoeff=[-9 3]; +p=poly(mycoeff,"x","coeff"); +ans=11*roots(p)+3; //since given number as calculated in line 7 +printf("The number is: %d",ans); diff --git a/1553/CH7/EX7.12/7Ex12.sce b/1553/CH7/EX7.12/7Ex12.sce new file mode 100644 index 000000000..1e8eeddad --- /dev/null +++ b/1553/CH7/EX7.12/7Ex12.sce @@ -0,0 +1,22 @@ +//Chapter 7 Ex12 +clc; +close; +//let ten's digit be x, thus unit's digit is 9-x +//number=10x+9-x=9x+9 +//number obtained by reversing digits=10(9-x)+x=90-9x +//polynomial is: 18x-144=0 + +mycoeff=[-144 18]; +p=poly(mycoeff,"x","coeff"); +ans=9*roots(p)+9; //since given number as calculated in line 6 +printf("The number is: %d",ans); + +//Alternative logic for same problem +for x=1:99 + if((18*x-144)==0) + + num=(9*x+9); + printf("\n Alternate logic: \n The number is: %d",num); + break; +end +end diff --git a/1553/CH7/EX7.13/7Ex13.sce b/1553/CH7/EX7.13/7Ex13.sce new file mode 100644 index 000000000..90a48293f --- /dev/null +++ b/1553/CH7/EX7.13/7Ex13.sce @@ -0,0 +1,19 @@ +//Chapter 7 Ex13 +clc; +clear; +close; +//let fraction be x/y + +x=poly(0,'x'); +y=(3*x+1)/2; //equation 1 +y=2*x-1; //equation 2 +for x=1:99 + if (3*x+1)/2 ==2*x-1 + mprintf("x=%i \n",x) + break + end +end +disp("substitute the x value in any one of the above equations to find y."); +y=2*x-1; + +printf("\nThe fraction is %d/%d",x,y); diff --git a/1553/CH7/EX7.14/7Ex14.sce b/1553/CH7/EX7.14/7Ex14.sce new file mode 100644 index 000000000..cfe316738 --- /dev/null +++ b/1553/CH7/EX7.14/7Ex14.sce @@ -0,0 +1,10 @@ +//chapter 7 Ex14 + +clc; +close; + +//Let one number be x, tbhus other is 50-x; according to given conditions forming the polynomial p=x^2-50*x+600; solving it we get +mycoeff=[600 -50 1]; +p=poly(mycoeff,"x","coeff"); +r=roots(p); +printf("The two parts are: %d and %d",r(1),r(2)); diff --git a/1553/CH7/EX7.2/7Ex2.sce b/1553/CH7/EX7.2/7Ex2.sce new file mode 100644 index 000000000..1ec9c6af3 --- /dev/null +++ b/1553/CH7/EX7.2/7Ex2.sce @@ -0,0 +1,20 @@ +//Chapter 7 Ex2 +clc; +clear; +close; +//let number be x +//given 7x-15=2x+10 +//thus polynomial is 5x-25=0 + +mycoeff=[-25 5]; +p=poly(mycoeff,"x","coeff"); +ans=roots(p); +printf("The number is: %d",ans); + +//Alternative logic for same problem +for x=1:99 + if((5*x-25)==0) + printf("\nAlternate logic: \nThe number is: %d",x); + break; +end +end diff --git a/1553/CH7/EX7.3/7Ex3.sce b/1553/CH7/EX7.3/7Ex3.sce new file mode 100644 index 000000000..d1384af51 --- /dev/null +++ b/1553/CH7/EX7.3/7Ex3.sce @@ -0,0 +1,11 @@ +//Chapter 7 Ex 3 +clc; +close; + +//let the number be x; thus the reciprocal is 1/x and equation (e1)can be formed as: +//x+(1/x)=13/6; converting it into a polynomial + +mycoeff=[6 -13 6]; +p=poly(mycoeff,"x","coeff"); +ans=roots(p); +printf("The number is: x=%1.1f or x=%1.1f",ans(1),ans(2)); diff --git a/1553/CH7/EX7.4/7Ex4.sce b/1553/CH7/EX7.4/7Ex4.sce new file mode 100644 index 000000000..f0d823d93 --- /dev/null +++ b/1553/CH7/EX7.4/7Ex4.sce @@ -0,0 +1,21 @@ +//Chapter 7 Ex4 +clc; +clear; +close; +//let number be x +//given (x/3)-(184-x)/7=8 +//thus polynomial is: 10x=720 + +mycoeff=[-720 10]; +p=poly(mycoeff,"x","coeff"); +ans=roots(p); +printf("The smaller number is: %d",ans); + + +//Alternative logic for same problem +for x=1:99 + if((10*x-720)==0) + printf("\n Alternate logic: \n The smaller number is: %d",x); + break; +end +end diff --git a/1553/CH7/EX7.5/7Ex5.sce b/1553/CH7/EX7.5/7Ex5.sce new file mode 100644 index 000000000..5d1703a72 --- /dev/null +++ b/1553/CH7/EX7.5/7Ex5.sce @@ -0,0 +1,20 @@ +//Chapter 7 Ex5 +clc; +clear; +close; +//let numbers be x and y + +x=poly(0,'x'); +y=x-11; //equation 1 +y=45-x; //equation 2 +for x=1:99 + if x-11 ==45-x + mprintf("x=%i \n ",x) + break + end +end +disp("substitute the x value in any one of the above equationsto find y."); +y=x-11; +printf("\nThus the numbers are %d and %d: \n",x,y); + + diff --git a/1553/CH7/EX7.6/7Ex6.sce b/1553/CH7/EX7.6/7Ex6.sce new file mode 100644 index 000000000..962317f79 --- /dev/null +++ b/1553/CH7/EX7.6/7Ex6.sce @@ -0,0 +1,17 @@ +//Chapter 7 Ex 6 +clc; +close; +//let number be x nad y, then x+y=42 and x*y=437 +//absolute differenec is given by: + +//sum=x+y; +Sum=42; + +//product=x*y; +product=437; + +eq=Sum^2-4*product; + +//diff=x-y; +Diff=sqrt(eq); +printf("Required difference is: %d",Diff); diff --git a/1553/CH7/EX7.7/7Ex7.sce b/1553/CH7/EX7.7/7Ex7.sce new file mode 100644 index 000000000..bc4e37756 --- /dev/null +++ b/1553/CH7/EX7.7/7Ex7.sce @@ -0,0 +1,10 @@ +//chapter 7 Ex7 + +clc; +close; + +//Let one number be x, tbhus other is 15-x; according to given conditions forming the polynomial p=x^2+(15-x)^2; solving it we get +mycoeff=[56 -15 1]; +p=poly(mycoeff,"x","coeff"); +r=roots(p); +printf("The two numbers are: %d and %d",r(1),r(2)); diff --git a/1553/CH7/EX7.8/7Ex8.sce b/1553/CH7/EX7.8/7Ex8.sce new file mode 100644 index 000000000..fed94530a --- /dev/null +++ b/1553/CH7/EX7.8/7Ex8.sce @@ -0,0 +1,15 @@ +////Chapter 7 Ex 8 +clc; +close; + +//Let first number be x, thus other numbers will be x+2,x+4,x+6 (since consecutive even); and the equation will be (sum/4)=27 + +//sum=x+(x+2)+(x+4)+(x+6); +//avg=27; //given +//avg=sum/4; +// given polynomial is x+(x+2)+(x+4)+(x+6)=108 + +mycoeff=[-96 4]; +p=poly(mycoeff,"x","coeff"); +r=roots(p)+6; +printf("The largest number is: %d",r) diff --git a/1553/CH7/EX7.9/7Ex9.sce b/1553/CH7/EX7.9/7Ex9.sce new file mode 100644 index 000000000..6ef55c787 --- /dev/null +++ b/1553/CH7/EX7.9/7Ex9.sce @@ -0,0 +1,16 @@ +//Chapter 7 Ex 9 + +clc; +close; + +//let first number be x,thus other numbers are x+2 and x+4; +//given is x^2+(x+2)^2+(x+4)^2=2531; after solving equation is x^2+4*x-837 + mycoeff=[-837 4 1]; +p=poly(mycoeff,"x","coeff"); +r=roots(p); +r1=r(1)+2; +r2=r(1)+4; +printf("The numbers are either %d, %d, %d OR",r(1),r1,r2); +r3=r(2)+2; +r4=r(2)+4; +printf(" %d, %d, %d",r(2),r3,r4); -- cgit