diff options
author | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
---|---|---|
committer | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
commit | 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch) | |
tree | dbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /413/CH7 | |
parent | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff) | |
download | Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2 Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip |
initial commit / add all books
Diffstat (limited to '413/CH7')
-rw-r--r-- | 413/CH7/EX7.1/Example_7_1.sce | 21 | ||||
-rw-r--r-- | 413/CH7/EX7.2/Example_7_2.sce | 30 | ||||
-rw-r--r-- | 413/CH7/EX7.3/Example_7_3.sce | 24 |
3 files changed, 75 insertions, 0 deletions
diff --git a/413/CH7/EX7.1/Example_7_1.sce b/413/CH7/EX7.1/Example_7_1.sce new file mode 100644 index 000000000..69dee877d --- /dev/null +++ b/413/CH7/EX7.1/Example_7_1.sce @@ -0,0 +1,21 @@ +clc
+clear
+x=-3
+function a=f(x)
+ a=exp(x)+2-cos(x);
+endfunction
+h=1
+ y=f(x)
+y1=f(x+h)
+while(abs(y-y1)>=0.00001)
+ y=f(x)
+ y1=f(x+h)
+ while(y>y1)
+ y=f(x)
+ y1=f(x+h)
+ T=[x+h, y1]
+ disp(T)
+ x=x+h
+ end
+ h=-h/4
+ end
\ No newline at end of file diff --git a/413/CH7/EX7.2/Example_7_2.sce b/413/CH7/EX7.2/Example_7_2.sce new file mode 100644 index 000000000..2fd122a96 --- /dev/null +++ b/413/CH7/EX7.2/Example_7_2.sce @@ -0,0 +1,30 @@ +clc
+clear
+a=-3
+b=1
+r=0.618034
+function a=f(x)
+ a=exp(x)+2-cos(x);
+endfunction
+xl=a+(1-r)*(b-a)
+xr=a+r*(b-a)
+FL=f(xl)
+FR=f(xr)
+while (abs(xr-xl)>0.001)
+ T=[xl,xr,FL,FR,a,b,a-b]
+ disp(T)
+ if(FR >FL)
+ b=xr
+ xr=xl
+ FR=FL
+ xl=a+(1-r)*(b-a)
+ FL=f(xl)
+ else
+ a=xl
+ xl=xr
+ FL=FR
+ xr=a+r*(b-a)
+ FR=f(xr)
+ end
+
+end
\ No newline at end of file diff --git a/413/CH7/EX7.3/Example_7_3.sce b/413/CH7/EX7.3/Example_7_3.sce new file mode 100644 index 000000000..906baed12 --- /dev/null +++ b/413/CH7/EX7.3/Example_7_3.sce @@ -0,0 +1,24 @@ +clc
+clear
+A=[5 8]
+B=[3 4
+ 2 5]
+C=[12
+ 10]
+printf('The Primal:')
+printf('\nMax f = %dx1+ %dx2',A(1,1),A(1,2))
+
+for i=1:2
+printf('\n%dx1 +%dx2<=%d', B(i,1),B(i,2),C(i,1))
+end
+printf('\nx1, x2>=0')
+A=A'
+B=B'
+C=C'
+printf('\n\nThe Dual:')
+printf('\nMin f = %dy1+ %dy2',C(1,1),C(1,2))
+
+for i=1:2
+printf('\n%dy1 +%dy2>=%d', B(i,1),B(i,2),A(i,1))
+end
+printf('\ny1, y2>=0')
\ No newline at end of file |