summaryrefslogtreecommitdiff
path: root/3588/CH5/EX5.3/EX5_3.sce
blob: 2a52fad7a0577368de42bccd4d7735ddf4f135fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//Clearing console
clc
clear

x = poly(0,"x")

//Intializing variables
x0 = 0
x1 = 1

K = [integrate('x*(x-1)*(x^2-x+2)','x',x0,x1)]

F = [integrate('x*(x-1)*3*x','x',x0,x1)]

c = F/K

S = c*x*(x-1)+x

//Calculating solution for given differntial equation
for t =1:11
    P(1,t) = (c*(t-1)*(t-11)/100)+(t-1)/10
end

//Constructing x matrix
t = 0:0.1:1;

//plotting solution
plot(t,P);
xtitle('solution','x','y(x)')

printf('\nResults\n')
printf('\nSolution of the Differential Equation y(x) =') 
disp(S)