summaryrefslogtreecommitdiff
path: root/23/CH2/EX2.6/Example_2_6.sce
blob: 265c01013dc5c02085110cb5df617558b5028b78 (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
34
35
clear;
clc;

//To find Approx Value
function[A]=approx(V,n)
  A=round(V*10^n)/10^n;//V-Value  n-To what place
  funcprot(0)
endfunction

//Example 2.6
//Caption : Program to find the work done by gas

//Given values
P=14;//Pressure=14bar
V1=0.03;//Initial volume=0.03m^3
V2=0.06;//Final Volume
//Process is isothermal
//(a)-To find the work done by gas in moving the External force
//(b)-To find the work done by gas if external force is suddenly reduced to half its initial value

//Solution
//(a)
K=P*V1*(10^5);//J
W1=approx(-K*integrate('1/V','V',0.03,0.06),0);//J
P2=K/V2;//Final Pressure(Pa)
P2=P2/(10^5);//bar
disp('J',W1,'(a)The work done by gas in moving the External Force is')

//(b)
W2=-P2*(10^5)*integrate('1','V',0.03,0.06)
n=approx((W2/W1)*100,1);//Efficiency
disp('J',W2,'(b)The work done by gas if external force is reduced to half is')
disp('%',n,'Hence the efficiency is')

//End