summaryrefslogtreecommitdiff
path: root/858/CH7/EX7.12/example_12.sce
blob: 1cc918120a399e5584de7c5e516cbd2715b28b41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
clc
clear 
printf("example 7.11 page number 316\n\n")

//to find the initial conc of A and B
Cp = 0.02;
Cq = 0.02;
K = 4*10^-2;
Cb = 0.05;
Cb_i = Cb+Cp;
a = (Cp*Cq)/(K*Cb);
funcprot(0)
function[f] = F(x,a)
    f = x-0.02-a;
endfunction

//initial guess
x = 10;
y = fsolve(x,F);
printf("conc of A= %f mol/l",y)
printf("\n\nconc of B= %f mol/l",Cb_i)