summaryrefslogtreecommitdiff
path: root/3588/CH5/EX5.4/EX5_4.sce
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /3588/CH5/EX5.4/EX5_4.sce
parentb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff)
downloadScilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip
initial commit / add all books
Diffstat (limited to '3588/CH5/EX5.4/EX5_4.sce')
-rw-r--r--3588/CH5/EX5.4/EX5_4.sce35
1 files changed, 35 insertions, 0 deletions
diff --git a/3588/CH5/EX5.4/EX5_4.sce b/3588/CH5/EX5.4/EX5_4.sce
new file mode 100644
index 000000000..eb1a1e597
--- /dev/null
+++ b/3588/CH5/EX5.4/EX5_4.sce
@@ -0,0 +1,35 @@
+//Clearing console
+clc
+clear
+
+x = poly(0,"x")
+//Intializing variables
+x0 = 0
+x1 = 1
+
+//Calculating constants in solution (Y = c*X) X-trial function
+c = integrate('x*(x-1)*(10*x^2+5)','x',x0,x1)/integrate('x*(x-1)*2','x',x0,x1)
+
+S1 = c*x*(x-1)
+
+//2nd part of problem
+
+//Consrtucting K and F matrices to solve the residual equations
+K(1,1:3) = [integrate('-x*(1-x^3)*12*x^2','x',x0,x1) integrate('x*(1-x^3)*(2-12*x^2)','x',x0,x1) integrate('x*(1-x^3)*(6*x-12*x^2)','x',x0,x1)]
+K(2,1:3) = [integrate('-x^2*(1-x^2)*12*x^2','x',x0,x1) integrate('x^2*(1-x^2)*(2-12*x^2)','x',x0,x1) integrate('x^2*(1-x^2)*(6*x-12*x^2)','x',x0,x1)]
+K(3,1:3) = [integrate('-x^3*(1-x)*12*x^2','x',x0,x1) integrate('x^3*(1-x)*(2-12*x^2)','x',x0,x1) integrate('x^3*(1-x)*(6*x-12*x^2)','x',x0,x1)]
+
+F = [integrate('x*(1-x^3)*(10*(x^2)+5)','x',x0,x1); integrate('x^2*(1-x^2)*(10*(x^2)+5)','x',x0,x1);integrate('x^3*(1-x)*(10*(x^2)+5)','x',x0,x1)]
+
+//Solving for constants in assumed solution
+U(1:3,1)=(linsolve(K,-F))
+
+c4 = -(U(1,1)+U(2,1)+U(3,1))
+S2 = U(1,1)*x +U(2,1)*x^2 +U(3,1)*x^3 +c4*x^4
+
+printf('\nResults\n')
+printf('\nSolution of the Differential Equation')
+printf('\nPart-1 y(x) = ')
+disp(S1)
+printf('\nPart-2 y(x) = ')
+disp(S2)